fix: import statements should not affect the route matching order #1307
Labels
status: needs triage
Issues which needs to be reproduced to be verified report.
type: fix
Issues describing a broken feature.
Description
We found in our project that a different order of Controller imports produces different results for a catch-all 404 route which blocks controllers imported earlier in the file.
A canonical sorting of imports is in my opinion common practice and it is not intuitive that the order matters in this case. Shouldn't the matching preference depend only on factors such as longest path and order inside the initializers
controllers
array?Minimal code-snippet showcasing the problem
controllers/NotFoundController.ts
controllers/ApplesController.ts
app.ts
Expected behavior
GET
http://localhost:3000/apples
["Granny Smith", "Braeburn"]
Actual behavior
GET
http://localhost:3000/apples
404 error
The text was updated successfully, but these errors were encountered: