# All

**Kind:** Constant

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

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

Route handler (method) Decorator. Routes all HTTP requests to the specified path.

`All` is a route handler decorator that maps every HTTP method to a controller method for a specified path. It is useful for catch-all endpoints, method-agnostic handlers, and scenarios where the handler determines how to process the incoming request.

## Definition

```ts
createMappingDecorator(RequestMethod.ALL)
```

## Value

```ts
createMappingDecorator(RequestMethod.ALL)
```

## Diagram

```mermaid
graph LR
  Client[HTTP Client] --> Request[Incoming HTTP Request]
  Request --> Router[Router]
  Router --> All["@All('/path')"]
  All --> Handler[Controller Method]
  Handler --> Response[HTTP Response]
```

## Usage

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

@Controller('webhooks')
export class WebhookController {
  @All('events')
  handleEvent(@Req() request: Request, @Res() response: Response) {
    console.log(`Received ${request.method} request`);

    response.status(200).json({
      received: true,
      method: request.method,
    });
  }
}
```

## AI Coding Instructions

- Use `@All()` when the same handler must accept multiple HTTP methods for a route.
- Prefer specific decorators such as `@Get()`, `@Post()`, or `@Patch()` when the endpoint supports only one method.
- Ensure the handler safely validates `request.method`, request headers, and payloads when handling multiple methods.
- Avoid overlapping `@All()` routes with more specific routes unless routing precedence is intentional.
- Use a controller-level path with `@Controller()` to keep `@All()` route paths concise and organized.
