Recipes
Router module
Put a whole module's routes under a path.
routeModule serves every controller of a module below a path, without touching the controllers:
app.http(adapter) {
setGlobalPrefix("api")
routeModule(DashboardModule::class, "/dashboard") { // nested modules add their paths together
routeModule(UsersModule::class, "/users")
}
}With UsersController at @Controller("/list") that gives GET /api/dashboard/users/list. The global prefix still comes first.
This lets two modules use the same controller paths: AdminModule and PublicModule can each have @Controller("/items") if they are mounted under /admin and /public. Duplicate routes are still refused, but the check is per module path (at build time within one module, at start-up across the whole application).
The API reference (useDocs), the devtools route list and error messages all show the served path, prefix and module path included.