Express 5 · Error handling
Handle 404s
Add a catch-all after your routes.
app.use((req, res) => {
res.status(404).json({ error: "Not found" });
});
Official Express 5 documentation
Express 5 · Error handling
Add a catch-all after your routes.
app.use((req, res) => {
res.status(404).json({ error: "Not found" });
});
Official Express 5 documentation
Was this page helpful?