diff --git a/examples/static.hs b/examples/static.hs new file mode 100644 index 00000000..7f8abb5a --- /dev/null +++ b/examples/static.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} + +import Yesod +import Yesod.Helpers.Static +import Network.Wai.Handler.SimpleServer + +data StaticExample = StaticExample + +mkYesod "StaticExample" [$parseRoutes| +/ Root StaticRoutes siteStaticRoutes getStaticSite +|] + +instance Yesod StaticExample where + approot _ = "http://localhost:3000" + +getStaticSite :: StaticExample -> Static +getStaticSite _ = fileLookupDir "dist/doc/html/yesod" + +main :: IO () +main = do + putStrLn "Running..." + toWaiApp StaticExample >>= run 3000