0.2.0 • Published 7 years ago

lambda-response v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

0.2.0

7 years ago

0.1.0

7 years ago