0.0.1 • Published 6 years ago

@repit/q-send v0.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

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