@repit/q-send

0.0.1 • Public • Published

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

Dependents (0)

Package Sidebar

Install

npm i @repit/q-send

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • sumanion