Add basic error handling
This commit is contained in:
parent
40a1c0570f
commit
50f3ece923
|
@ -54,6 +54,11 @@ var API = module.exports = function API(opts) {
|
|||
|
||||
// load route definitions
|
||||
this.express.use('/api', require('./api/routes'));
|
||||
|
||||
// error handling
|
||||
this.express.use(function(err, req, res, next) {
|
||||
res.json(500, { error: err.message || "An error occured."})
|
||||
});
|
||||
};
|
||||
|
||||
API.prototype.defaults = {
|
||||
|
|
Loading…
Reference in New Issue