Automatically server every static file
This commit is contained in:
parent
619bd7f7dd
commit
ba784701b4
@ -24,13 +24,16 @@ app runner = do
|
||||
ServerSettings {..} <- newServerSettings
|
||||
table <- load urlTable
|
||||
|
||||
css <- getDataFileName "layouts/main.css"
|
||||
index <- getDataFileName "views/index.html"
|
||||
done <- getDataFileName "views/done.html"
|
||||
static <- getDataFileName "static/"
|
||||
index <- getDataFileName "views/index.html"
|
||||
done <- getDataFileName "views/done.html"
|
||||
|
||||
runner $ controllerApp settings $ do
|
||||
get "/" (render index ())
|
||||
get "/main.css" (serveStatic css)
|
||||
|
||||
get "/:file" $ do
|
||||
file <- queryParam' "file"
|
||||
serveStatic (static ++ file)
|
||||
|
||||
get "/:name" $ do
|
||||
name <- queryParam' "name"
|
||||
|
@ -26,7 +26,7 @@ data AppSettings = AppSettings {}
|
||||
|
||||
instance HasTemplates IO AppSettings where
|
||||
defaultLayout = do
|
||||
main <- liftIO (getDataFileName "layouts/main.html")
|
||||
main <- liftIO (getDataFileName "static/main.html")
|
||||
Just <$> getTemplate main
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user