summaryrefslogtreecommitdiff
path: root/overlays/spm/server/Spm/Server/UI.hs
blob: 544e4f54815f17425e5b956cb3cdfd77ffee1959 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-}

module Spm.Server.UI
  ( uiServer
  ) where

import Prelude

import Network.Wai

import Network.Wai.Application.Static
import WaiAppStatic.Types

import Data.FileEmbed


uiServer :: Application
uiServer = staticApp settings
    { ssLookupFile = \pcs -> ssLookupFile settings pcs >>= \case
        LRNotFound -> ssLookupFile settings [unsafeToPiece "index.html"]
        o -> return o
    }
  where settings = embeddedSettings $(embedDir "frontend")