summaryrefslogtreecommitdiff
path: root/apex/Ibb.hs
diff options
context:
space:
mode:
Diffstat (limited to 'apex/Ibb.hs')
-rw-r--r--apex/Ibb.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/apex/Ibb.hs b/apex/Ibb.hs
index ad9af38..dd26d96 100644
--- a/apex/Ibb.hs
+++ b/apex/Ibb.hs
@@ -16,6 +16,7 @@ import Lucid.Base
import Miso
import Network.HTTP.Types
import Network.Wai
+import Network.Wai.Application.Static
import Network.Wai.Handler.Warp
import Network.Wai.Middleware.Gzip
import Network.Wai.Middleware.RequestLogger
@@ -41,13 +42,14 @@ instance L.ToHtml a => L.ToHtml (HtmlPage a) where
L.doctypehtml_ $ do
L.head_ $ do
L.meta_ [L.charset_ "utf-8"]
- jsRef "ibb.jsexe/all.js"
+ jsRef "/static/app.js"
L.body_ (L.toHtml x)
where
jsRef href = L.with (L.script_ mempty)
[ makeAttribute "src" href
- , makeAttribute "async" mempty
- , makeAttribute "defer" mempty
+ , makeAttribute "type" "text/javascript"
+ -- , makeAttribute "async" mempty
+ -- , makeAttribute "defer" mempty
]
type ServerRoutes = ToServerRoutes Routes HtmlPage Action
@@ -60,15 +62,19 @@ handle404 _ respond = respond
$ HtmlPage
$ notfound
-type Api = ServerRoutes :<|> Raw
+type Api = "static" :> Raw
+ :<|> ServerRoutes
+ :<|> Raw
app :: Application
app = serve (Proxy @Api)
- $ serverHandlers :<|> Tagged handle404
+ $ static :<|> serverHandlers :<|> Tagged handle404
+ where
+ static = serveDirectoryWith (defaultWebAppSettings "ibb.jsexe")
serverHandlers :: Server ServerRoutes
serverHandlers = homeHandler
where
send f u =
- pure $ HtmlPage $ f Model { modelUri = u, people = [] }
+ pure $ HtmlPage $ f Model { uri = u, people = NotAsked }
homeHandler = send home goHome