New WebApi Project doesn't have default routing for API (but still works)

asp.net-mvc, asp.net-web-api, asp.net-web-api-routing, c#

Solution

The Visual Studio project templates creates a default route which looks like:

routes.MapHttpRoute(
   name: "API Default",
   routeTemplate: "api/{controller}/{id}",
   defaults: new { id = RouteParameter.Optional }
);

You can find this in the `WebApiConfig.cs` file, which is placed in the `App_Start` directory

http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api

Problem

I've created a new WebAPI MVC project, the API controllers have the path `http://localhost:1234/api` and they work from this route, but the `RegisterRoutes` class doesn't contain a default routing, it contains the following: ``` public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } ``` Where's the routing for the API? Cheers Dave

Original source