http-error-express

1.0.0 • Public • Published

HTTP error middleware

A simple Express middleware to deal coherently with HTTP errors in Express, expecially useful when creating web APIs. See http-error for the companion error module.

Usage

var Express = require('express');
var httpErrorExpress = require('http-error-express');

var express = Express();
express.use(httpErrorExpress());

Notes

It's reccomended to use http-error-express as the last middleware. Errors without status property will be treated as HTPP 500 - Internal server error. Given err the incoming error, it will render a message as:

{
    message: err.message,
    data: err.data
}

Readme

Keywords

none

Package Sidebar

Install

npm i http-error-express

Weekly Downloads

13

Version

1.0.0

License

LGPL-3.0

Unpacked Size

1.4 kB

Total Files

3

Last publish

Collaborators

  • uwburn