ajl-express-error-middleware
Advanced tools
Comparing version
13
index.js
@@ -1,3 +0,10 @@ | ||
module.exports = function() { | ||
return function(err, req, res, next) { | ||
module.exports = function(app) { | ||
// catch 404 and forward to error handler | ||
app.use(function(req, res, next) { | ||
var err = new Error('Not Found'); | ||
err.status = 404; | ||
next(err); | ||
}); | ||
app.use(function(err, req, res, next) { | ||
var locals = { | ||
@@ -17,3 +24,3 @@ message: err.message, | ||
res.render('error', locals); | ||
}; | ||
}); | ||
}; |
{ | ||
"name": "ajl-express-error-middleware", | ||
"version": "1.0.0", | ||
"description": "Error handling middleware for a NodeJS Express app", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/aliatsis/ajl-express-error-middleware.git" | ||
}, | ||
"author": "Anthony Liatsis <anthony.liatsis@gmail.com>", | ||
"license": "-", | ||
"bugs": { | ||
"url": "https://github.com/aliatsis/ajl-express-error-middleware/issues" | ||
}, | ||
"homepage": "https://github.com/aliatsis/ajl-express-error-middleware" | ||
} | ||
"name": "ajl-express-error-middleware", | ||
"version": "1.0.1", | ||
"description": "Error handling middleware for a NodeJS Express app", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/aliatsis/ajl-express-error-middleware.git" | ||
}, | ||
"author": "Anthony Liatsis <anthony.liatsis@gmail.com>", | ||
"license": "-", | ||
"bugs": { | ||
"url": "https://github.com/aliatsis/ajl-express-error-middleware/issues" | ||
}, | ||
"homepage": "https://github.com/aliatsis/ajl-express-error-middleware" | ||
} |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
1290
12.66%20
42.86%