How to prepend a common prefix to all URLs before the controller in ASP.NET API?
I'm working on an ASP.NET API project where I have multiple controllers, and I want to prepend a common prefix to all the URLs before the controller route. For example, I want all my API endpoints to have the prefix "/appapi/" followed by the controller name. I know that I can achieve this by manually adding the prefix in each controller using the [Route]attribute, like [Route("appapi/MyController")]. However, this requires updating every controller, which can be time-consuming and error-prone. Is there a more efficient and centralized way to add this common prefix to all the URLs without modi
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.