Reputation: 113
When i start a project (.Net Core MVC), Index.chtml opens as usual. How to open Swagger interface by default.
I have default route like this:
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
Upvotes: 4
Views: 1466
Reputation: 1375
You can achieve this using couple of ways:
launchsettings.json
file and change the value of the applicationUrl
parameter to swagger url.Or
routes.MapHttpRoute(
name: "swagger_root",
routeTemplate: "",
defaults: null,
constraints: null,
handler: new RedirectHandler((message => message.RequestUri.ToString()), "swagger"));
Or
Launch browser
in project properties, Debug tab:Upvotes: 1
Reputation: 10872
There's several ways you could achieve this:
Upvotes: 2