Skip to content

emanueleliardo/lambda-response

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

AWS Lambda response creator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%