blob: e47ffc428b9c314070c2d347cc7c46e03cb2d17e (
plain)
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
26
27
28
|
-- | The main module. Does little more than handle some basic ocnfic, then
-- call the server
module Main where
import Control.Monad.IO.Class (MonadIO (liftIO))
import Control.Monad.Logger (runStderrLoggingT)
import Data.Default.Class (def)
import Database.Persist.Postgresql
import Network.Wai.Handler.Warp (run)
import Network.Wai.Middleware.RequestLogger (OutputFormat (..),
RequestLoggerSettings (..),
mkRequestLogger)
import GTFS
import Server
connStr = "user=travelynx"
main :: IO ()
main = do
gtfs <- loadGtfs "./gtfs.zip"
loggerMiddleware <- mkRequestLogger
$ def { outputFormat = Detailed True }
runStderrLoggingT $ withPostgresqlPool connStr 10 $ \pool -> liftIO $ do
app <- application gtfs pool
putStrLn "starting server …"
run 4000 (loggerMiddleware app)
|