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 "."
data Sample = Sample
getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "tests" }
data Sample = Sample { getStatic :: Static }
--getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "." }
mkYesod "Sample" [parseRoutes|
/ RootR GET
/static StaticR Static getStatic
|]
instance Yesod Sample where approot _ = ""
instance Yesod Sample where
approot _ = ""
cleanPath _ = Right -- FIXME make this unnecessary perhaps
getRootR = do
redirectText RedirectPermanent "static"
return ()
main = toWaiApp Sample >>= run 3000
main = do
s <- static "."
toWaiApp (Sample s) >>= run 3000