A function to create the response object for AWS Lambdas
npm install lambda-response --save
const lambdaResponse = require('lambda-response')
const data = {
foo: 'bar'
}
//optional
const options = {
cors: true //default true
}
lambdaResponse.success(200, data, options)
{
statusCode: '200',
headers: {
"Access-Control-Allow-Origin" : "*",
"Content-Type': "application/json"
},
body: JSON.stringify({ "foo": "bar" })
}
npm test
npm run-script test-travis