packages feed

breve-0.3.0.0: src/Main.hs

{-# 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)