In the first release of the ASP.NET Web API, the routing mechanism was convention-based. This type of routing has definition for one or more route templates in terms of parameterized strings.
This style of routing is still supported in ASP.NET Core; the following code snippet shows how to achieve this:
public void Configure(IApplicationBuilder app) { //Rest of code removed for brevity app.UseMvc(routes => { // route1 routes.MapRoute( name: "packtroute1", template: "api/{controller}/{id}" ); // route2 routes.MapRoute( name: "packtroute1", template: "testpackt", defaults: new { controller = "Books", action = "Index" } ); }); }
The convention...