lambda-http-utils is a utility to make it easy to do parameter checking while developing serverless application like AWS Lambda + API Gateway.
Install:
npm install lambda-http-utils --save-dev
const lambdaUtils = require('lambda-http-utils');
new lambdaUtils.HttpUtils.Builder(headers, body)
.withHeaderVal('Content-Type', 'application/json')
.withBody('some_key')
.build()
.check()
.then((data) => {
// Do something with parsed data...
})
.catch((err) => {
// Something went wrong
});
MIT. See LICENSE for details.