# Req

**Kind:** Constant

**Source:** [`packages/common/decorators/http/route-params.decorator.ts`](https://github.com/nestjs/nest/blob/master/packages/common/decorators/http/route-params.decorator.ts#L783)

**Part of:** [Common](subsystem-packages-common)

Route handler parameter decorator. Extracts the `Request`
object from the underlying platform and populates the decorated
parameter with the value of `Request`.

Alias for

`Req` is a route handler parameter decorator that injects the underlying platform request object into a controller method parameter. It is typically used when access to raw request details—such as headers, cookies, URL parameters, or platform-specific properties—is needed.

## Definition

```ts
Request
```

## Value

```ts
Request
```

## Diagram

```mermaid
graph LR
  A[Incoming HTTP Request] --> B[Platform Adapter]
  B --> C[Controller Route Handler]
  C --> D[@Req() Decorated Parameter]
  D --> E[Request Object]
```

## Usage

```ts
import { Controller, Get, Req } from '@nestjs/common';
import type { Request } from 'express';

@Controller('users')
export class UsersController {
  @Get('profile')
  getProfile(@Req() request: Request) {
    return {
      userAgent: request.headers['user-agent'],
      path: request.path,
    };
  }
}
```

## AI Coding Instructions

- Use `@Req()` only when the full underlying request object is required; prefer focused decorators such as `@Body()`, `@Param()`, or `@Headers()` for specific values.
- Type the parameter using the request type provided by the active HTTP platform, such as Express `Request` or Fastify `FastifyRequest`.
- Avoid coupling business logic directly to the raw request object; extract required values in the controller and pass them to services.
- Remember that request properties may vary between HTTP adapters, so avoid relying on adapter-specific fields unless the application is intentionally platform-specific.

## Used by

6 references from 6 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Imported by (6)

- `AppController` — `integration/nest-application/app-locals/src/app.controller.ts`:4
- `AppController` — `integration/nest-application/global-prefix/src/app.controller.ts`:3
- `ExpressController` — `integration/nest-application/raw-body/src/express.controller.ts`:4
- `FastifyController` — `integration/nest-application/raw-body/src/fastify.controller.ts`:4
- `PassthroughInterceptor` — `integration/nest-application/sse/src/app.controller.ts`:28
- `AppController` — `integration/nest-application/use-body-parser/src/app.controller.ts`:4
