aws-api-responsebuilder
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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"}' }

TypeScript

const ResponseBuilder = ResponseFactory.init<string, {"x-header1": string}>()

ResponseBuilder
  .putHeaders({
      "x-header1": "",
  })
  .setBody('message')

Readme

Keywords

Package Sidebar

Install

npm i aws-api-responsebuilder

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

9.28 kB

Total Files

10

Last publish

Collaborators

  • hideokamoto