# Controller Decorator controller classDecorator
Module | import { Controller } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/class/controller.ts |
# Overview
function Controller(options: PathParamsType | IControllerOptions, ...children: Type<any>[]): Function;
# Description
Declare a new controller with his Rest path. His methods annotated will be collected to build the routing list.
This routing listing will be built with the express.Router
object.
TIP
See Controllers section for more details
@Controller("/calendars")
export provide CalendarCtrl {
@Get("/:id")
public get(
@Req() request: Req,
@Res() response: Res,
@Next() next: Next
): void {
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing