Add fullPath function for inspecting and logging full resolved request path (#81)

This commit is contained in:
Connor Prussin
2017-09-29 09:52:21 -07:00
committed by GitHub
parent a5e29897b2
commit f38c5987ee
4 changed files with 51 additions and 3 deletions

View File

@@ -21,10 +21,12 @@ loggingMiddleware :: forall e.
HTTPure.Request ->
HTTPure.ResponseM (console :: Console.CONSOLE | e)
loggingMiddleware router request = do
EffClass.liftEff $ Console.log $ "Request starting for " <> show request.path
EffClass.liftEff $ Console.log $ "Request starting for " <> path
response <- router request
EffClass.liftEff $ Console.log $ "Request ending for " <> show request.path
EffClass.liftEff $ Console.log $ "Request ending for " <> path
pure response
where
path = HTTPure.fullPath request
-- | A middleware that adds the X-Middleware header to the response, if it
-- | wasn't already in the response