Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we create multiple paths for the same controller function? #1345

Open
crossdsection opened this issue Feb 6, 2024 · 7 comments
Open
Labels
type: question Questions about the usage of the library.

Comments

@crossdsection
Copy link

crossdsection commented Feb 6, 2024

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?

@crossdsection crossdsection added the type: question Questions about the usage of the library. label Feb 6, 2024
@attilaorosz
Copy link
Member

That is an interesting use case, I never tried it myself but it should be fine in theory.

@crossdsection
Copy link
Author

@attilaorosz the above code failed, is there any other way to achieve that?

@attilaorosz
Copy link
Member

When you say failed what do you mean? Is it crashing or not registering the routes?

@crossdsection
Copy link
Author

@attilaorosz Crashing.

@attilaorosz
Copy link
Member

Could you setup a minimal repro repo so I can take a look?

@soknifedev
Copy link

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.

@attilaorosz
Copy link
Member

I just tested it locally and it works as expected. What kind of error do you get?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Questions about the usage of the library.
Development

No branches or pull requests

3 participants