Overview - res.status for status codes
What is it?
res.status is a method in Express.js used to set the HTTP status code of a response. HTTP status codes tell the client if a request was successful, failed, or needs further action. Using res.status, you can specify codes like 200 for success or 404 for not found before sending the response.
Why it matters
Without setting status codes properly, clients like browsers or apps won't know if their request worked or failed. This can cause confusion, broken features, or poor user experience. res.status helps communicate clearly what happened on the server side, making web apps reliable and predictable.
Where it fits
Before learning res.status, you should understand basic Express.js routing and how to send responses with res.send or res.json. After mastering res.status, you can learn about error handling middleware and advanced HTTP concepts like redirects and caching.