Updated yesod-static sample

This commit is contained in:
Michael Snoyman 2012-01-07 18:14:27 +02:00
parent 205b3bf6b3
commit a835359451

View File

@ -9,16 +9,21 @@ import Network.Wai.Application.Static
staticFiles "." staticFiles "."
data Sample = Sample data Sample = Sample { getStatic :: Static }
getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "tests" }
--getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "." }
mkYesod "Sample" [parseRoutes| mkYesod "Sample" [parseRoutes|
/ RootR GET / RootR GET
/static StaticR Static getStatic /static StaticR Static getStatic
|] |]
instance Yesod Sample where approot _ = "" instance Yesod Sample where
approot _ = ""
cleanPath _ = Right -- FIXME make this unnecessary perhaps
getRootR = do getRootR = do
redirectText RedirectPermanent "static" redirectText RedirectPermanent "static"
return () return ()
main = toWaiApp Sample >>= run 3000 main = do
s <- static "."
toWaiApp (Sample s) >>= run 3000