$ npm i -S aws-api-responsebuilder
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"}' }
const ResponseBuilder = ResponseFactory.init<string, {"x-header1": string}>()
ResponseBuilder
.putHeaders({
"x-header1": "",
})
.setBody('message')