aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 0b3165e..7d3b5dc 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -26,16 +26,21 @@ import Network.Wai.Handler.Warp (run)
import Network.Wai.Middleware.RequestLogger (OutputFormat (..),
RequestLoggerSettings (..),
mkRequestLogger)
+import Database.Persist.Postgresql
+import Control.Monad.Logger (runStderrLoggingT)
+import Control.Monad.IO.Class (MonadIO (liftIO))
import GTFS
import Server
+connStr = "user=travelynx"
main :: IO ()
main = do
gtfs <- loadGtfs "./gtfs.zip"
- app <- application gtfs
loggerMiddleware <- mkRequestLogger
$ def { outputFormat = Detailed True }
- putStrLn "starting server …"
- run 4000 (loggerMiddleware app)
+ runStderrLoggingT $ withPostgresqlPool connStr 10 $ \pool -> liftIO $ do
+ app <- application gtfs pool
+ putStrLn "starting server …"
+ run 4000 (loggerMiddleware app)