Fixes TypeError: res.sendStatus is not a function when accessing non-existing routes.
Define error-handling middleware functions in the same way as other middleware functions, except with four arguments instead of three, specifically with the signature (err, req, res, next)):
Fixes
TypeError: res.sendStatus is not a function
when accessing non-existing routes.https://expressjs.com/en/api.html ("Error-handling middleware")