Closed ben-leonard-tbol closed 11 months ago
Hello there ben-leonard-tbol š
Thank you for opening your very first issue in this project.
We will try to get back to you as soon as we can.š
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Hey @ben-leonard-tbol!
Did you proceed by duplicating the controller code or did you find a more elegant solution?
I currently have a single version of an api with the following resources which contains endpoints for creating a product, retrieving all etc.
v1/products
v1/orders
.In order to support this I have a controller attributes like
@Route('v1/products')
. I now need a new version of my api, products endpoints need a breaking change so I have a new controller for that and the appropriate functions with the@Route('v2/products')
attribute.The orders endpoint never changes except for the version. So I was hoping to add another attribute with the new version which would mean two route attributes are added but I get the following error
Only one Route decorator allowed
. I could duplicate the controller code and update the route but this added a lot of duplicate code.Whats the best mechanism to support multiple versions for a controller?
Sorting
I am submitting a support ticket to understand if the preferred mechanism to support this
I confirm that I
Expected Behavior
Ability to add another Route attribute to identify a given controller should work for multiple routes.
Current Behavior
Adding another Route attribute
Only one Route decorator allowed
Possible Solution
Assuming support of multiple Route attribute / accept an array. There might be better solutions that currently exist.