Module

HTTPure.Middleware

Package
purescript-httpure-middleware
Repository
joneshf/purescript-httpure-middleware

#LogLifecycle Source

type LogLifecycle a = { after :: Request -> Response -> a -> Aff String, before :: Request -> Aff a }

The lifecycle functions around logging.

Used to prepare metadata for the logs.

#LogTime Source

type LogTime = { duration :: Milliseconds, start :: DateTime, stop :: DateTime }

A helper that encapsulates the different information around request time.

#Middleware Source

type Middleware = (Request -> ResponseM) -> Request -> ResponseM

A helper for cleaning up type signatures.

#combinedLogFormat Source

combinedLogFormat :: Middleware

A middleware that logs requests in the Combined Log Format.

#commonLogFormat Source

commonLogFormat :: Middleware

A middleware that logs requests in the Common Log Format.

#developmentLogFormat Source

developmentLogFormat :: Middleware

A middleware that logs request in an unstandardized development format. The logs are more verbose, colorful, and a bit easier to read.

#log Source

log :: forall a. LogLifecycle a -> Middleware

Logs the request given the lifecycle functions.

#logWithTime Source

logWithTime :: (LogTime -> Request -> Response -> Aff String) -> Middleware

Helper for logging when all you need is the time metadata.

#timeout Source

timeout :: forall a. Duration a => a -> Middleware

A middleware that prevents requests from running for too long.

If a request takes longer than the duration specified, it returns a 500 status code