API Gateway Response builder for AWS Lambda
Install
npm i lambda-api-gateway-response
Usage
Chainable methods
Method | Description | Default value |
---|---|---|
status | Set HTTP status code | 200 |
headers | Set response headers | - |
body | Set response body | null |
send | Invoke callback | - |
This
callback status200 headers 'access-control-allow-origin': '*' body "foo": "bar" ;
will be send as:
statusCode: 200 headers: "access-control-allow-origin": "*" body: "foo": "bar"
Example
var ApiGatewayResponse = ; exports { return callback status200 headers 'access-control-allow-origin': '*' body "foo": "bar" ;}
Contribute
If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.