AWS Lambda Runner
A tiny (2KB Compressed & Minified) wrapper utility to make running your aws lambda functions cleaner. Inspired heavily/completely by the node-apex library.
Features
- Pairs perfectly with the apex serverless solution.
- Supports Lambda Proxy Integrations w/ API Gateway Proxy.
- Provide custom headers & status codes to include with the response.
- Enable cors for the requests.
- One function can handle methods and paths.
Installation
yarn add aws-lambda-runner
OR
npm install --save aws-lambda-runner
Example
Without Default Configuration
async { return hello: 'world' }
With Default Configuration
// default status code to return to the caller when using proxy integration. statusCode: 200 // do we want to add the 'Access-Control-Allow-Origin' header to our response? cors: true // do we want to add any headers to the response? We can add new headers by // mutating the received config object headers: null async { /* Handle our function, the resolution of the promise will be used to populate the body. This does not need to be an async function, we can return a standard object or promise to be resolved. Errors during execution are caught and passed to the caller. */ return hello: 'world' }
Configuration Object
Dynamic Configuration Values
- headers
- cors
- statusCode
Static Configuration Values
- isProxy
- request
- query
- path
- method
- pathParameters
- stageVariables