An error handler for JSON APIs, meant to be used with http-errors-style errors.
varerrorHandler=require('api-error-handler');varapi=newexpress.Router();api.get('/users/:userid',function(req,res,next){});api.use(errorHandler());app.use('/api',api);Currently no options.
4xx errors are exposed to the client. Properties exposed are:
messagetypenamecodestatus
5xx errors are not exposed to the client.
Instead, they are given a generic message as well as the type.