@Req()
Injects the underlying platform request object into a handler parameter.
Syntax
@Req() | @Request() Returns
ParameterDecorator — A decorator that binds the native request object.
Examples
import { Controller, Get, Req } from '@nestjs/common';
import { Request } from 'express';
@Controller('cats')
export class CatsController {
@Get()
find(@Req() req: Request) {
return req.method;
}
}
Notes
@Req() exposes the raw Express or Fastify request. Prefer the dedicated
decorators (@Body, @Param, @Query, @Headers) where possible to keep
handlers platform-agnostic and testable.