1.3.0 • Published 5 years ago

node-https-response v1.3.0

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

node-https-response

A simple object to return http response object with required headers for AWS api gatway to enable the cors

Build Status NPM version

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 response
  • body: Object | String - object of statusCode, message, data as a parameter
  • headers: Object - the headers of the response. The keys are automatically made lower case.

License

ISC