express-api-error-handler
express-api-error-handler is a simple library for error handling in express apps It's compatible with joi and http-errors;
Installation
npm i --save express-api-error-handler
bunyan as a logger
Sample usage withYou can test the below example by running npm run example
// app.js ;;;;; const app = ;const logger = bunyan; app; app; app; app; app; const PORT = 3000;app;
Errors from http-errors
GET http://localhost:3000/error
Response:
Console log:
Errors from Joi
GET http://localhost:3000/joi
Response:
Console log:
Not found routes
GET http://localhost:3000/foobar
Response:
Console log:
API
Error handler
Not found handler
MIT License
Copyright (c) 2016 Łukasz Sentkiewicz