Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

err handling express

app.get('/', function (req, res, next) {
  fs.readFile('/file-does-not-exist', function (err, data) {
    if (err) {
      next(err) // Pass errors to Express.
    } else {
      res.send(data)
    }
  })
})
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #err #handling #express
ADD COMMENT
Topic
Name
9+8 =