I want to simulate a 404 error on my Express/Node server. How can I do that?
Since Express 4.0, there's a dedicated sendStatus function:
sendStatus
res.sendStatus(404);
If you're using an earlier version of Express, use the status function instead.
status
res.status(404).send('Not found');
1.4m articles
1.4m replys
5 comments
57.0k users