# Routes & Decorators Deep Dive — NestJS

Source: https://www.geekswithgeeks.com/en/nestjs/nestjs-decorators-routes

> Master parameter decorators, response handling, and status codes.

## Decorators: Param, Body, Query

Extract different parts of a request with decorator arguments.

```typescript
@Post(':id')
update(
  @Param('id') id: string,
  @Body() updateDto: UpdateUserDto,
  @Query('notify') notify?: boolean
) {
  return this.usersService.update(id, updateDto, notify);
}
```

## Status codes & headers

Use `@HttpCode()` to override the default status (201 for POST), and `@Header()` to set response headers.

```typescript
@Post()
@HttpCode(202)
@Header('X-Custom', 'value')
create(@Body() dto: CreateUserDto) {
  return this.usersService.create(dto);
}
```

## Nested routes & wildcards

Stack controllers and paths—e.g. `@Controller('api/users')` + `@Get(':id/posts')` → `/api/users/:id/posts`.
