File: sample.hs

package info (click to toggle)
haskell-yesod-static 1.6.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: haskell: 1,381; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE QuasiQuotes, TypeFamilies, MultiParamTypeClasses #-}
{-# LANGUAGE TemplateHaskell #-}
import Yesod.Static
import Yesod.Core
import Network.Wai.Handler.Warp (run)
import Network.Wai.Application.Static

staticFiles "."

data Sample = Sample { getStatic :: Static }

--getStatic _ = Static $ defaultFileServerSettings { ssFolder = fileSystemLookup $ toFilePath "." }
mkYesod "Sample" [parseRoutes|
/ RootR GET
/static StaticR Static getStatic
|]
instance Yesod Sample where

getRootR = do
    redirect "static"
    return ()

main = do
    s <- static "."
    toWaiApp (Sample s) >>= run 3000