AWS Amazon API Gateway Response builder

Build Status npm version

logo

Getting started

$ npm i -S aws-api-responsebuilder

Usage

import AWSAPIs from 'aws-api-responsebuilder'

const { ResponseBuilder } = AWSAPIs
ResponseBuilder.setStatusCode(400)
ResponseBuilder.setBody({
    message: `Invalid Request`,
    code: 'invalid_request'
})
console.log(ResponseBuilder.getResponse())

{ statusCode: 400,
  headers:
   { 'Access-Control-Allow-Origin': '*',
     'Access-Control-Allow-Credentials': true },
  body: '{"message":"Invalid Request","code":"invalid_request"}' }