Express Lambda invoker
A wrapper of lambda-invoker as an express middleware. See lambda-invoker.
Installation
npm install express-lambda-invoker --save
Usage
const express = ;const router = express;const expressLambdaInvoker = const lambdaArn = 'arn:aws:lambda:...' const options = region: 'eu-west-1' // default eu-west-1 accessKeyId: 'aws access key id...' secretAccessKey: 'aws secret access key...' payloadAttrName: 'reqObjectAttribute' const invokerMiddleware = // Routesrouter
The payload that is sent to Lambda is req[options.payloadAttrName]
. The Lambda's response is replaced to that attribute. If not present req.body
is used.