Open
Description
Description
Controllers are created in the order they are registered with metadata, not in the order they are passed into the router controller options.
@Controller()
class ThirdController {
@Get('/*')
getAll() {
return 'Third';
}
}
@Controller()
class SecondController {
@Get('/second/*')
getAll() {
return 'Second';
}
}
@Controller()
class FirstController {
@Get('/second/first/*')
getAll() {
return 'First';
}
}
createExpressServer({
controllers: [FirstController, SecondController, ThirdController],
})
Expected behavior
Requests are handle by the First controller, which is the first in the controller order, but last to be registered.
GET /second/first/any
First
Actual behavior
Requests are handle by the Third controller, which is the last in the controller order, but first to be registered.
GET /second/first/any
Third