From a835359451a705c5dada5d89eab8139ed2aae130 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sat, 7 Jan 2012 18:14:27 +0200 Subject: [PATCH] Updated yesod-static sample --- yesod-static/sample.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/yesod-static/sample.hs b/yesod-static/sample.hs index 9b219f2d..d0a25db1 100644 --- a/yesod-static/sample.hs +++ b/yesod-static/sample.hs @@ -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