req and res

The request and response objects that Node.js-style handlers receive, conventionally named req and res.

In more detail

req describes the incoming request and res is written to build the response, with methods such as res.status() and res.json(). They are Node.js objects, not the standard Web Request and Response.

Example

Next.js Pages Router API routes use them; App Router Route Handlers use Web Request and Response instead.

Related terms

Taught in

References