# 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