make logs

This commit is contained in:
nek0 2019-04-16 13:30:16 +02:00
parent f6503a1707
commit 7f12f0116e
2 changed files with 7 additions and 1 deletions

View file

@ -33,6 +33,8 @@ executable mateamt
, product-profunctors , product-profunctors
, postgresql-simple , postgresql-simple
, warp , warp
, wai
, wai-logger
, http-api-data , http-api-data
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010

View file

@ -7,6 +7,8 @@ import Data.Time.Clock
import Database.PostgreSQL.Simple import Database.PostgreSQL.Simple
import Network.Wai
import Network.Wai.Logger
import Network.Wai.Handler.Warp import Network.Wai.Handler.Warp
import Opaleye import Opaleye
@ -27,7 +29,9 @@ main = do
conn <- connectPostgreSQL conn <- connectPostgreSQL
"host='localhost' port=5432 dbname='mateamt' user='mateamt' password='mateamt'" "host='localhost' port=5432 dbname='mateamt' user='mateamt' password='mateamt'"
execute_ conn initUser execute_ conn initUser
run 3000 (app conn) withStdoutLogger $ \log -> do
let settings = setPort 3000 $ setLogger log defaultSettings
runSettings settings (app conn)
app :: Connection -> Application app :: Connection -> Application
app conn = serve userApi (users conn) app conn = serve userApi (users conn)