1app.use(function (err, req, res, next) {
2 console.error(err.stack)
3 res.status(500).send('Something broke!')
4})
5
1app.get('/', function (req, res, next) {
2 fs.readFile('/file-does-not-exist', function (err, data) {
3 if (err) {
4 next(err) // Pass errors to Express.
5 } else {
6 res.send(data)
7 }
8 })
9})
10