Yes, controller classes can be used to define http routes. The routes are defined as methods decorated with the appropriate HTTP verb decorators, such as @http.GET
or @http.POST
. For example:
import { http, HttpRouterRegistry } from '@deepkit/http'; class UserController { constructor(private database: Database) {} @http.GET('/user/:id') getUser(id: number) { // Route logic } } const app = new App({ controllers: [UserController], imports: [new FrameworkModule()] });