Automatically server every static file

master
rnhmjoj 2015-04-21 17:26:26 +02:00
parent 619bd7f7dd
commit ba784701b4
2 changed files with 8 additions and 5 deletions

View File

@ -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"

View File

@ -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