Express Request Methods

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

About This Index

This page is the Express Request 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 request data such as req.params, req.query, or req.body.

Beginner path.

Start with req.params, req.query, and req.body—then req.get() for headers and req.ip for the client address.

How to Read the Request Object

Access properties and helpers on req inside middleware and routes:

Express
app.get("/users/:id", (req, res) => {
  const id = req.params.id;
  const page = req.query.page;
  const agent = req.get("User-Agent");

  res.json({
    id,
    page,
    method: req.method,
    path: req.path,
    ip: req.ip,
    agent
  });
});

app.post("/items", express.json(), (req, res) => {
  if (!req.is("json")) {
    return res.sendStatus(415);
  }
  res.status(201).json(req.body);
});

Express Request Methods Table

All Request property and method guides in this Express.js tutorial series (29 tutorials).

Request Data

5 methods

Read what the client sent — params, query, body, and cookies.

MethodDescriptionTutorial
req.paramsNamed route parameters from the matched path (for example /users/:id).Try it
req.queryParsed query-string values from the URL after ?.Try it
req.bodyParsed request body — filled by express.json() / express.urlencoded().Try it
req.cookiesParsed cookies object when cookie-parser middleware is used.Try it
req.signedCookiesSigned cookies verified by cookie-parser — tamper-resistant values.Try it

URL & Routing

5 methods

Inspect method, path, mount base, original URL, and matched route.

MethodDescriptionTutorial
req.methodHTTP method string for the request — GET, POST, PUT, DELETE, and more.Try it
req.pathPath portion of the URL — useful inside mounted routers.Try it
req.baseUrlURL path on which a router instance was mounted.Try it
req.originalUrlOriginal request URL including query string — unchanged by mounts.Try it
req.routeThe currently matched Route object — path, stack, and methods.Try it

Headers & Negotiation

7 methods

Read headers and negotiate Accept / Content-Type / Range.

MethodDescriptionTutorial
req.get()Read a request header by name (case-insensitive).Try it
req.is()Check if the Content-Type matches a type string such as json or html.Try it
req.accepts()Content negotiation — pick the best Accept type the client allows.Try it
req.acceptsCharsets()Negotiate preferred character sets from Accept-Charset.Try it
req.acceptsEncodings()Negotiate preferred encodings from Accept-Encoding.Try it
req.acceptsLanguages()Negotiate preferred languages from Accept-Language.Try it
req.range()Parse Range headers for partial content / file downloads.Try it

Host & Connection

8 methods

Protocol, host, client IP, subdomains, and XHR detection.

MethodDescriptionTutorial
req.protocolRequest protocol — http or https (respects trust proxy).Try it
req.secureTrue when the connection is HTTPS (shortcut for protocol === 'https').Try it
req.hostnameHostname from the Host / X-Forwarded-Host header.Try it
req.hostHost header value including optional port.Try it
req.ipRemote IP address of the client (respects trust proxy).Try it
req.ipsArray of IP addresses from X-Forwarded-For when trust proxy is set.Try it
req.subdomainsSubdomain labels parsed from the hostname.Try it
req.xhrTrue when X-Requested-With is XMLHttpRequest (classic AJAX).Try it

Cache Freshness

2 methods

Check whether conditional GET responses are still fresh.

MethodDescriptionTutorial
req.freshTrue when the response is still fresh per cache validators.Try it
req.staleOpposite of req.fresh — true when the cached response is stale.Try it

App & Response Links

2 methods

Reach the owning app and the paired res object from req.

MethodDescriptionTutorial
req.appReference to the Express application that owns this request.Try it
req.resReference to the paired response object for this request.Try it

Frequently Asked Questions

req is the incoming HTTP request passed to every middleware and route handler. Express extends Node’s IncomingMessage with helpers for params, query, body, headers, and negotiation.
Use req.params for path segments, req.query for the query string, and req.body for parsed bodies after express.json() or express.urlencoded().
Call req.get('Header-Name') (case-insensitive). For Content-Type checks, prefer req.is('json') or similar.
No. Treat params, query, body, cookies, and headers as untrusted input—validate and sanitize before use in every Express tutorial project.
Start with req.params, req.query, and req.body, then req.get() and req.ip when you need headers or client address.

Start with req.params

Open the route-params guide—syntax, examples, and FAQs.

req.params 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