How to programmatically send a 404 response with Express/Node?
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’);