node-https-response
A simple object to return http response object with required headers for AWS api gatway to enable the cors
Installation
npm install node-https-response
Usage
//success method
var response = ;var res = 200 'Successfully submited' 'This is my Data' header1 : 25 header2 :'Play' ;//statusCode === 200 //message === OK//body === {}//headers === {} , if headers are not passed , default headers will be passed to enable the cors for AWS API gateway . //error methodvar response = ;var res = 404 'Page Not found' ;//statusCode === 400//message === 'Bad Request'
Properties
statusCode
: Number - the status code of the responsebody
: Object | String - object of statusCode, message, data as a parameterheaders
: Object - the headers of the response. The keys are automatically made lower case.
License
ISC