Repit Q-Send
R/Q Middleware to simplify AWS Lambda responses.
About
This module is a wrapper for @repit/lambda-send.
Installation
$ npm install @repit/q-send --save
Usage
'use strict'
const q = require('@repit/q')()
const send = require('@repit/q-send')
q(send())
q((req, res) => {
// Set the HTTP status code of the response.
res.code(statusCode)
// Enable / Disable CORS.
res.cors(enabled) // Default: true.
// Set custom headers of the response.
res.headers({})
// Set custom response body fields.
res.body({})
// Send the response.
res.send(payload)
})
exports.handler = q.handler
License
MIT