BSD-3-Clause licensed by Dobromir Nikolov
Maintained by [email protected]
This version can be pinned in stack with:aws-lambda-haskell-runtime-wai-2.0.2@sha256:459c183c37e99e13c83002bedb2dc58c2257d2741aeec3f86571ee58361e9404,1986

Module documentation for 2.0.2

aws-lambda-haskell-runtime-wai Hackage Haskell CI

Quick start

  1. Set up your project to use AWS Lambda by following the instructions on the aws-lambda-haskell-runtime website.
  2. Use the waiHandler function from AWS.Lambda.Wai to convert your wai application to a handler. There are two ways to do this.
-- 1. Pass in the initializeApplicationFunction
-- this will call initializeApplication per each call
handler :: WaiHandler ()
handler = waiHandler initializeApplication

-- Wai application initialization logic
initializeApplication :: IO Application
initializeApplication = ...
-- 2. Store the Application inside your custom context and provide a getter function
-- this will initialize the application once per cold start and keep it alive while the lambda is warm
handler :: WaiHandler MyAppConfig
handler = waiHandler' getWaiApp

data MyAppConfig =
  MyAppConfig
    { getWaiApp :: Application }

For a complete example see theam/aws-lambda-haskell-runtime/tree/master/examples/wai-app

Changes

Changelog for aws-lambda-haskell-runtime-wai

2.0.2

  • Make registering multiple wai handlers possible (via waiHandler).
  • Make registering multiple handlers with multiple Wai Applications possible (via runMultipleWaiApplications).
  • Use version 4.1.1 of aws-lambda-haskell-runtime.

2.0.1

  • Use version 4.1.0 of aws-lambda-haskell-runtime that fixes #101.

2.0.0

  • Use version 4.0.0 of aws-lambda-haskell-runtime.
  • New handler types that allow you to support ALB or even API Gateway + ALB at once.

1.0.3

  • Now taking the Wai request path from API Gateway’s ‘proxy’ path parameter. This prevents the resource path from messing up your Wai application routing.

1.0.2

  • Switched to aws-lambda-haskell-runtime 3.0.3

1.0.1

  • Removed forgotten print statements
  • Applied a temporary hotfix for handling query parameters