npm.io
0.2.0 • Published 2 years ago

express-bang

Licence
ISC
Version
0.2.0
Deps
0
Size
88 kB
Vulns
0
Weekly
0

express-bang

Send http-friendly error objects in express.

Install

npm install --save express-bang

Usage

// commonJS
const expressBang = require('express-bang');

// ESM
import expressBang from 'express-bang';

app.use(expressBang());


app.get("/test", (req, res) => {
    res.bang.badRequest("Internal Server Error");
});

Why expressbang?

The package is heavily inspired from boom error objects and express middleware package called - express-boom. Unlike express-boom, express-bang is a standalone implementation and doesn't depend on any third-party package for getting methods.