Added static example
This commit is contained in:
parent
4163c55e0d
commit
aa2cc2f0eb
24
examples/static.hs
Normal file
24
examples/static.hs
Normal file
@ -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
|
||||||
Loading…
Reference in New Issue
Block a user