Skip to content
This repository was archived by the owner on Jul 20, 2019. It is now read-only.

cjihrig/exploder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exploder

Current Version Build Status via Travis CI Dependencies belly-button-style

HTTP-friendly error objects. This is a port of the 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.

About

Express port of Boom

Resources

License

Stars

Watchers

Forks

Packages

No packages published