postgrest-9.0.0: REST API for any Postgres database
Safe HaskellNone
LanguageHaskell2010

PostgREST.Middleware

Description

 
Synopsis

Documentation

runPgLocals :: AppConfig -> HashMap Text Value -> (ApiRequest -> ExceptT Error Transaction Response) -> ApiRequest -> ByteString -> PgVersion -> ExceptT Error Transaction Response Source #

Runs local(transaction scoped) GUCs for every request, plus the pre-request function

pgrstFormat :: Status -> OutputFormatter Source #

Log in apache format. Only requests that have a status greater than minStatus are logged. | There's no way to filter logs in the apache format on wai-extra: https://hackage.haskell.org/package/wai-extra-3.0.29.2/docs/Network-Wai-Middleware-RequestLogger.html#t:OutputFormat. | So here we copy wai-logger apacheLogStr function: https://github.com/kazu-yamamoto/logger/blob/a4f51b909a099c51af7a3f75cf16e19a06f9e257/wai-logger/Network/Wai/Logger/Apache.hs#L45 | TODO: Add the ability to filter apache logs on wai-extra and remove this function.

corsPolicy :: Request -> Maybe CorsResourcePolicy Source #

CORS policy to be used in by Wai Cors middleware

optionalRollback :: AppConfig -> ApiRequest -> ExceptT Error Transaction Response -> ExceptT Error Transaction Response Source #

Set a transaction to eventually roll back if requested and set respective headers on the response.