routing-controllers icon indicating copy to clipboard operation
routing-controllers copied to clipboard

fix: create controllers in specified order

Open getfatday opened this issue 2 years ago • 3 comments

Description

Controllers are created in the order they are passed into the router controller options, not in the order they are registered with metadata

Checklist

  • [x] the pull request title describes what this PR does (not a vague title like Update index.md)
  • [x] the pull request targets the default branch of the repository (develop)
  • [x] the code follows the established code style of the repository
    • npm run prettier:check passes
    • npm run lint:check passes
  • [x] tests are added for the changes I made (if any source code was modified)
  • [x] documentation added or updated
  • [x] I have run the project locally and verified that there are no errors

Fixes

Fixes typestack/routing-controllers#774

getfatday avatar Sep 16 '21 19:09 getfatday

I faced the same problem that mentioned in #774 in a bit different manner. I agree that import ordering in server bootstrap is counter-intuitive and hope this will be merged, or at least there'll be some explanation in docs for @Controller and @{Method} parametrized decorators.

dantaeusb avatar Dec 03 '21 14:12 dantaeusb

+1 for this. Frustrating and counter intuitive.

alexberriman avatar Feb 08 '22 03:02 alexberriman

This is reasonable and I agree with the solution, but this might be breaking for some people who rely solely on the workaround. @NoNameProvided thoughts?

attilaorosz avatar Feb 17 '22 10:02 attilaorosz