Global route for all controllers
See original GitHub issueHi,
is there any suggested way how to set a “global” route for all controllers?
For example, I want to define this route:
/api/
for my controllers:
@Controller('user')
export class UserController
@Controller('customer')
export class CustomerController
with the following result:
/api/user
/api/customer
Thank you
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Global route for all ApiControllers in .Net 6 - Stack Overflow
This work fine but i need to put this route top of all my ApiControllers in my project, When i decide to change...
Read more >Global route prefixes with attribute routing in ASP.NET Web API
ASP.NET Web API allows you to provide a common route prefix for all the routes within a controller via RoutePrefixAttribute. This is obviously...
Read more >Routing to controller actions in ASP.NET Core - Microsoft Learn
ASP.NET Core controllers use the Routing middleware to match the URLs of incoming requests and map them to actions. Route templates:.
Read more >Global Routes for ASP.NET Core MVC - Ben Cull's Blog
The approach we'll take is to read all of our controller's routes and either combine our prefix with any existing routes, or create...
Read more >Global route prefix in ASP.NET Core MVC (revisited)
In this case, api/v{version} will prefix every single route in your application. So you can now write controllers without any controller-level ...
Read more >Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @jezikk, Since version
2.1.0
you can usesetGlobalPrefix(prefix: string)
method. Example:@flogvit
As you can create multiple swagger documents (like, for every API version) it makes sense that it is no automatically derived from
app