1app.get('/', function (req, res) {
2 throw new Error('BROKEN') // Express will catch this on its own.
3})
4
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