@Delete()
Maps a controller method to an HTTP DELETE request for the given path.
Syntax
@Delete(path?: string | string[]) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
path | string | string[] | No | Optional route path appended to the controller prefix. |
Returns
MethodDecorator — A decorator applied to the route handler method.
Examples
import { Controller, Delete, Param, HttpCode } from '@nestjs/common';
@Controller('cats')
export class CatsController {
@Delete(':id')
@HttpCode(204)
remove(@Param('id') id: string) {
return;
}
}
Notes
DELETE removes a resource and is idempotent. Pair with @HttpCode(204) when
returning no body to signal a successful no-content response.