Controller decorators
@Controller
Decorator to declare a class as a controller class
Signature
typescript
@Controller(prefix?: string, options?: ControllerOptions)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
prefix | string | No | - | A prefix to add to all controller method routes |
options | Object | No | {} | Configuration: |
↳guards | NustGuard[] | No | - | A list of guards to add to all controller method routes |
Route Decorators
@Get
Decorator to declare a GET method route server handler
Signature
typescript
@Get(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Post
Decorator to declare a POST method route server handler
Signature
typescript
@Post(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Put
Decorator to declare a PUT method route server handler
Signature
typescript
@Put(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Patch
Decorator to declare a PATCH method route server handler
Signature
typescript
@Patch(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Delete
Decorator to declare a DELETE method route server handler
Signature
typescript
@Delete(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Options
Decorator to declare a OPTIONS method route server handler
Signature
typescript
@Options(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Head
Decorator to declare a HEAD method route server handler
Signature
typescript
@Head(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |
@Any
Decorator to declare a method route server handler that will catch all request methods
Signature
typescript
@Any(path: string)
Parameters
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
path | string | Yes | - | The path of the route |