Express Response Methods

Beginner
8 min read
Updated: Nov 2026
24 method guides
Method index

About This Index

This page is the Express Response index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

In every route handler, Express passes (req, res). Use this page when you need to finish a request with res.send(), res.json(), or res.status().

Beginner path.

Start with res.send() and res.json(), then res.status()—add res.redirect() and res.render() when you need navigation or templates.

How to Call a Response Method

Chain status and headers, then send exactly one body (or redirect/render):

Express
app.get("/", (req, res) => {
  res.send("Hello Express");
});

app.get("/api/user", (req, res) => {
  res.status(200).json({ id: 1, name: "Ada" });
});

app.post("/login", (req, res) => {
  res.cookie("sid", "abc", { httpOnly: true });
  res.redirect("/dashboard");
});

app.get("/about", (req, res) => {
  res.render("about", { title: "About" });
});

Express Response Methods Table

All Response property and method guides in this Express.js tutorial series (24 tutorials).

Sending a Body

6 methods

Finish the response — send, JSON, JSONP, end, status-only, and format.

MethodDescriptionTutorial
res.send()Send a response body — strings, Buffers, objects, or arrays.Try it
res.json()Send a JSON response — sets Content-Type and serializes the value.Try it
res.jsonp()Send a JSONP response with an optional callback query parameter.Try it
res.end()End the response process without sending more body data.Try it
res.sendStatus()Set the status code and send its string name as the body.Try it
res.format()Content negotiation — respond differently per Accept type.Try it

Status & Headers

8 methods

Set status codes and response headers before the body is sent.

MethodDescriptionTutorial
res.status()Set the HTTP status code and chain another response method.Try it
res.set()Set one or more response headers (alias: res.header).Try it
res.get()Read a response header that was already set on res.Try it
res.type()Set the Content-Type from a MIME string or file extension.Try it
res.append()Append a value to a response header (multi-value headers).Try it
res.vary()Add a field to the Vary response header for caches.Try it
res.links()Populate the Link header with relation URLs.Try it
res.headersSentBoolean — true after response headers have been written.Try it

Redirects

2 methods

Send the client to another URL with Location / redirect helpers.

MethodDescriptionTutorial
res.redirect()Redirect the client to a URL with an optional status code.Try it
res.location()Set the Location header without ending the response.Try it

Files & Downloads

3 methods

Stream files from disk or force a download dialog.

MethodDescriptionTutorial
res.sendFile()Transfer a file from disk as the response body.Try it
res.download()Prompt a file download with Content-Disposition attachment.Try it
res.attachment()Set Content-Disposition to attachment — optionally with a filename.Try it

Cookies

2 methods

Set and clear cookies on the outgoing response.

MethodDescriptionTutorial
res.cookie()Set a cookie on the response with name, value, and options.Try it
res.clearCookie()Clear a cookie by name — matching path and other options.Try it

Views

2 methods

Render templates and pass request-scoped locals.

MethodDescriptionTutorial
res.render()Render a view template and send the HTML as the response.Try it
res.localsRequest-scoped variables available to templates during render.Try it

App Link

1 method

Reach the owning Express application from res.

MethodDescriptionTutorial
res.appReference to the Express application that owns this response.Try it

Frequently Asked Questions

res is the outgoing HTTP response passed to every middleware and route handler. Express extends Node’s ServerResponse with helpers like status(), send(), json(), set(), and redirect().
Start with res.send() and res.json() for bodies, then res.status() for codes, then res.redirect() and res.render() when you need navigation or templates.
Prefer res.json() for API objects and arrays—it sets application/json and serializes safely. res.send() is flexible for strings, Buffers, and simple bodies.
No. Send exactly one final response per request. Return after early exits, and avoid double sends in async handlers.
Start with res.send() and res.json(), then res.status(). Open res.redirect() and res.render() when you need redirects or views.

Start with res.send()

Open the send guide—syntax, examples, and FAQs.

res.send() tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

16 people found this page helpful