exploder

1.0.0 • Public • Published

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.

Package Sidebar

Install

npm i exploder

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • cjihrig