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:
res.sendStatus(404);
If you're using an earlier version of Express, use the status
function instead.
res.status(404).send('Not found');