22 lines
516 B
Haskell
22 lines
516 B
Haskell
{-# LANGUAGE OverloadedStrings, NamedFieldPuns #-}
|
|
|
|
import Application
|
|
import Breve.Settings
|
|
import Breve.UrlTable
|
|
|
|
import Web.Spock.Safe
|
|
import Network.Wai.Handler.Warp (run)
|
|
|
|
runBreve :: Int -> SpockT IO () -> IO ()
|
|
runBreve port app = spockAsApp (spockT id app) >>= run port
|
|
|
|
|
|
main :: IO ()
|
|
main = do
|
|
AppSettings { bindUrl
|
|
, bindPort
|
|
, urlTable } <- settings
|
|
table <- load urlTable
|
|
putStrLn ("Serving on " ++ bindUrl)
|
|
runBreve bindPort (app bindUrl table)
|
|
|