New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

boomify

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boomify

A simple higher order component to handle errors using boom and express.

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

boomify NPM version Build Status Dependency Status Coverage Status

A simple higher order component to handle errors using boom and express.

Installation

$ npm install --save boomify

Usage


var app = require('express')();
var boom = require('boom');
var boomify = require('boomify');

var ctrl = {
  findOne(req, res) => res.send(boom.notFound('could not find!')),
  morePractically(req, res) => {
    if(err) {
      // boomify will convert this to the appropriate response object
      return res.send(err); 
    }
    res.status(200);
    res.send({ foo: 'bar' });
  }
};

// boomify whole ctrl
app.get('/cats/findOne', boomify(ctrl).findOne);

// boomify a single method
boomify(ctrl, 'findOne');
app.get('/cats/findOne', ctrl.findOne);

// will convert boom.notFound to res.error(404); res.send(err.output.payload);

Tests

mocha test

License

Apache-2.0 © blugavere

Keywords

FAQs

Package last updated on 12 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc