-
Notifications
You must be signed in to change notification settings - Fork 12
/
Main.hs
24 lines (20 loc) · 993 Bytes
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Main where
import Control.Monad (join)
import Control.Applicative ((<$>))
import Controllers.Home (home, login, post)
import Data.Maybe (fromMaybe)
import Network.Wai.Middleware.RequestLogger (logStdoutDev)
import Network.Wai.Middleware.Static (addBase, noDots,
staticPolicy, (>->))
import System.Environment (lookupEnv)
import Text.Read (readMaybe)
import Web.Scotty (middleware, scotty)
main :: IO ()
main = do
port <- fromMaybe 3000
. join
. fmap readMaybe <$> lookupEnv "PORT"
scotty port $ do
middleware $ staticPolicy (noDots >-> addBase "static/images") -- for favicon.ico
middleware logStdoutDev
home >> login >> post