| Copyright | (C) 2021 Bellroy Pty Ltd |
|---|---|
| License | BSD-3-Clause |
| Maintainer | Bellroy Tech Team <haskell@bellroy.com> |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Network.Wai.Handler.Hal
Description
Lifts an Application so that it can be run using
mRuntime or
mRuntimeWithContext'. The glue code will look
something like this:
import AWS.Lambda.Runtime (mRuntime) import Network.Wai (Application) import qualified Network.Wai.Handler.Hal as WaiHandler app :: Application app = undefined -- From Servant or wherever else main :: IO () main =mRuntime$ WaiHandler.runapp
Synopsis
- run :: MonadIO m => Application -> ProxyRequest NoAuthorizer -> m ProxyResponse
- runWithContext :: MonadIO m => Options -> (Key LambdaContext -> Key (ProxyRequest NoAuthorizer) -> Application) -> LambdaContext -> ProxyRequest NoAuthorizer -> m ProxyResponse
- data Options = Options {
- vault :: Vault
- portNumber :: PortNumber
- binaryMimeType :: Text -> Bool
- defaultOptions :: Options
- toWaiRequest :: Options -> ProxyRequest a -> IO Request
- fromWaiResponse :: Options -> Response -> IO ProxyResponse
Documentation
run :: MonadIO m => Application -> ProxyRequest NoAuthorizer -> m ProxyResponse Source #
Convert a WAI Application into a function that can
be run by hal's mRuntime. This is the simplest
form, and probably all that you'll need. See runWithContext if
you have more complex needs.
Arguments
| :: MonadIO m | |
| => Options | Configuration options. |
| -> (Key LambdaContext -> Key (ProxyRequest NoAuthorizer) -> Application) | We pass two
|
| -> LambdaContext | |
| -> ProxyRequest NoAuthorizer | We force |
| -> m ProxyResponse |
Convert a WAI Application into a function that can
be run by hal's mRuntimeWithContext'. This
function exposes all the configurable knobs.
Options that can be used to customize the behaviour of runWithContext.
defaultOptions provides sensible defaults.
Constructors
| Options | |
Fields
| |
defaultOptions :: Options Source #
Default options for running Applications on Lambda.
toWaiRequest :: Options -> ProxyRequest a -> IO Request Source #
Convert the request sent to a Lambda serving an API Gateway proxy integration into a WAI request.
Note: We aren't told the HTTP version the client is using, so we assume HTTP 1.1.
fromWaiResponse :: Options -> Response -> IO ProxyResponse Source #
Convert a WAI Response into a hal
ProxyResponse.