node express dynamic route and error handler

JavaScript
app.use(function (req, res, next) {
  res.status(404).send("Sorry can't find that!")
})

Source

Also in JavaScript: