routing-controllers
routing-controllers copied to clipboard
Can we create multiple paths for the same controller function?
I was trying to...
@Get(`/api/v1/getdetails`)
@Get(`/api/v2/details`)
public async getDetail(
The problem:
We are trying to rename the bad API paths, without removing the old one. Is that possible, using the routing-controller
package?
That is an interesting use case, I never tried it myself but it should be fine in theory.
@attilaorosz the above code failed, is there any other way to achieve that?
When you say failed what do you mean? Is it crashing or not registering the routes?
@attilaorosz Crashing.
Could you setup a minimal repro repo so I can take a look?
I would love to have a feature to use multiple paths for a controller.
@JsonController("/base/endpoint")
@JsonController("/old-base-routes/endpoint")
This would be useful to prepare our api to deprecate routes and start using the new ones before a major change.
I just tested it locally and it works as expected. What kind of error do you get?