1.0.0 • Published 7 years ago

exploder v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

exploder

Current Version Build Status via Travis CI Dependencies

belly-button-style

HTTP-friendly error objects. This is a port of hapi's boom module as express middleware. It is based on express-boom.

Example

const Express = require('express');
const Exploder = require('exploder');

const app = Express();

app.use(Exploder());

app.use(function (req, res) {
  res.boom.notFound(); // Responds with a 404 status code
});

API

For a complete list of methods offered by boom, see the boom documentation.

exploder also provides the following options when setting up the middleware:

  • format(err) (function) - A function that formats the boom error before replying to the client. This only applies to functions that send a response to the client (i.e. not wrap() or create()). By default, the boom error's output.payload is sent as the response payload. If a format() function is provided, the complete boom error is passed as the only argument, and the return value is sent as the response payload.
1.0.0

7 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.2

8 years ago