express-boom
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/express-boom package

3.0.0 • Public • Published

express-boom

Boom response objects in Express.

Install

npm install express-boom --save

Usage

var express = require('express');
var boom = require('express-boom');
 
var app = express();
 
app.use(boom());
 
app.use(function (req, res) {
  res.boom.notFound(); // Responds with a 404 status code
});
 
app.use(function (req, res) {
  // some validation check fail and returns an object : reasons
  
  res.boom.badRequest("Validation didn't suceed", reasons); // Responds Boom message + reasons object
});
 
app.listen(4444);

For a complete list of methods, see the Boom docs

Package Sidebar

Install

npm i express-boom

Weekly Downloads

3,348

Version

3.0.0

License

MIT

Unpacked Size

4.48 kB

Total Files

5

Last publish

Collaborators

  • scottcorgan