Skip to content

Controller

@tsed/di

Usage

typescript
import { Controller } from "@tsed/di";

See /packages/di/src/types/common/decorators/controller.ts.

Overview

ts
function Controller(options: PathType | ControllerOptions): 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

typescript
 @Controller("/calendars")
 export class CalendarCtrl {

   @Get("/:id")
   public get(
     @Req() request: Req,
     @Res() response: Res,
     @Next() next: Next
   ): void {

   }
 }

Released under the MIT License.