@salte-io/salte-lambda
v2.0.1
Published
[![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] [![CI Build][github-actions-image]][github-actions-url] [![Coveralls][coveralls-image]][coveralls-url]
Downloads
14
Readme
Salte Lambda
An opinionated wrapper for AWS Lambda that enables the use of Promises.
Install
You can install this package either with npm
.
npm
$ npm install @salte-io/salte-lambda
Usage
const wrapper = require('@salte-io/salte-lambda');
exports.handler = wrapper((event, context) => {
if (!event.body.myAttribute) {
return Promise.reject({
statusCode: 400,
code: 'missing_my_attribute',
message: '"myAttribute" is required!'
});
}
return Promise.resolve({
my_attribute: event.body.myAttribute
});
});