This package adds a super flexible
res.error() method to express that logs an error and sends the correct JSON response to the client
npm install res-error --savein your project directory
- Apply it as middleware to your app (before the router):
var app = express(); app.use(require('res-error')); ... ````
The response object will now contain an
error method which can be passed a code, message string, and/or error object.
It's very flexible. Here are more examples:
Oh no, I found a bug!
Please submit an issue! :)