AWS Lambda response creator
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

Lambda response creator

A function to create the response object for AWS Lambdas

Installation

npm install lambda-response --save

Usage

const lambdaResponse = require('lambda-response')

const data = {
  foo: 'bar'
}

//optional
const options = {
  cors: true  //default true
}

lambdaResponse.success(200, data, options)

Response

{
  statusCode: '200',
  headers: {
    "Access-Control-Allow-Origin" : "*",
    "Content-Type': "application/json"
  },
  body: JSON.stringify({ "foo": "bar" })
}

Tests

npm test

Coverage

npm run-script test-travis

Author

Palmabit

License

MIT license