A.HADDAD
A.HADDAD

Reputation: 1906

Change the default route in Asp.net core Web Api

I have deleted the valueController and Created a new Controller in my asp.net core web api project which i named : entreprise

In order to serve that controller in launch of the project i tried to change the route in Startup.cs:

app.UseMvc(
            routes => 
            {
                routes.MapRoute(name: "api",
                 template: "api/{controller=Entreprise}/{action=Get}/{id?}");
            }
            );

however , that dosen't change anything !? when i launch the project again it open this url : https://localhost:44307/api/values what i want is https://localhost:44307/api/entreprise

Upvotes: 1

Views: 2215

Answers (1)

devb
devb

Reputation: 279

edit the Properties\launchSettings.json file and modify the launchUrl value accordingly.

Upvotes: 3

Related Questions