This tutorial is based exclusively on Maximillian Schwarzmüller's Creating a REST API with Node.js starting with Part 3 Handling Errors & Improving the Project Setup. It shows just the coding occurring in video 4.
"keywords": ["nodejs",
"restful",
"api"
],
app.use((req, res, next) => { const error = new Error('Not found'); error.status(404); next(error); }) app.use((error, req, res, next) => { res.status(error.status || 500); res.json({ error: { message: error.message } }); });