# Decorator Controller
Decorator controller classDecoratorModule | import { Controller } from "@tsed/common" |
---|---|
Source | /packages/common/src/mvc/decorators/class/controller.ts |
# Overview
function Controller(options: PathParamsType | ControllerOptions, ...children: Type<any>[]): ClassDecorator;
# 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
Other topics
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Seq
- OIDC
- Stripe
- Controllers
- Providers
- Model
- JsonMapper
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Exceptions
- Hooks
- Response Filter
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing