npm.io
0.0.2 • Published 8 years ago

@repit/q

Licence
MIT
Version
0.0.2
Deps
0
Vulns
0
Weekly
0

Repit Q

A better way to write AWS Lambda functions.

Installation

$ npm install @repit/q --save

Usage

'use strict'

const q = require('@repit/q')()

// Define a basic middleware.
q((req, res) => {
  // Do something and stop.
})

// Define a basic middleware.
q((req, res, next) => {
  // Do something and continue.
  next()
})

// Define a middleware which sends an error.
q((req, res, next) => {
  // Do something and send an error to error handlers.
  next(new Error('Something went wrong.'))
})

// Define an error handler middleware.
q((err, req, res, next) => {
  // Do something with the error and continue.
  next()
})

// Define an error handler middleware.
q((err, req, res, next) => {
  // Do something with the error and stop.
})

exports.handler = q.handler

License

MIT