1.0.0 • Published 5 years ago

http-error-express v1.0.0

Weekly downloads
1
License
LGPL-3.0
Repository
github
Last release
5 years ago

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
}