Sometimes, we want to programmatically send a 404 response with Express and Node.js.
In this article, we’ll look at how to programmatically send a 404 response with Express and Node.js.
How to programmatically send a 404 response with Express and Node.js?
To programmatically send a 404 response with Express and Node.js, we can call res.sendStatus
.
For instance, we write
res.sendStatus(404);
to send a response with the 404 status code.
Conclusion
To programmatically send a 404 response with Express and Node.js, we can call res.sendStatus
.