0.0.2 • Published 6 years ago
@repit/q v0.0.2
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