Package Exports
- lambda-compose
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lambda-compose) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
lambda-compose
lambda-compose adds middleware and promise support to your lambda functions.
installation
npm install lambda-compose
example
const compose = require('lambda-compose')
// example using callback
export.myLambdaFunction = compose(
(context, event, callback, next) => {
// jump to next middleware:
next()
},
(context, event, callback) => {
// run the callback of the lambda function
callback(null, { statusCode: 200, body: 'ok' })
})
// example using promises
export.mySecondLambdaFunction = compose(
(context, event, callback, next) => {
// jump to next middleware:
next()
},
(context, event) => Promise.resolve({ statusCode: 200, body: 'ok' })
)License
Copyright (c) 2017 Simon Kusterer Licensed under the MIT license.