Need Assistance?

support@tutorialshub.in

Request & Response Objects

Sending Responses (res.send, res.json, res.status)

ADVERTISEMENT
Express.js Free Lesson
5 min read
ADVERTISEMENT

The res object represents the HTTP response your Express server sends back. Express supports method chaining so you can set a status code and send a payload in one clean statement.

Common Response Methods

  • res.send() — Sends strings, HTML, Buffers, or objects (auto-sets Content-Type).
  • res.json() — Explicitly serializes data as JSON with application/json header.
  • res.status(code) — Sets the HTTP status code before sending.
  • res.sendStatus(code) — Sets status and sends its standard text message (e.g., 204 No Content).
ADVERTISEMENT
Hi, I'm Tuby! Here to help you