node-https-response
v1.3.0
Published
A simple object to return http response object with required headers for AWS api gatway to enable the cors
Downloads
5
Maintainers
Readme
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 = require('node-https-response');
var res = new response.success(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 method
var response = require('node-https-response');
var res = new response.error(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