make logs
This commit is contained in:
parent
f6503a1707
commit
7f12f0116e
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue