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