ASP.NET - Enhancing your Web API: Part 1 [8 of 13]

Play ASP.NET - Enhancing your Web API: Part 1 [8 of 13]
Sign in to queue

The Discussion

  • User profile image
    Niner737557
    In a previous video you explicitly set the "route" for our API page. In this video you modified the scafolding value "api/[controller]" to "[controller]" but did not explain the pixie dust that changes "[controller]" to "products" in our web application. Where does the value for "[controller]" come from in this example?
  • User profile image
    rmcgarry
    @Niner737557:

    This confused me as well. It appears to come from the class name. Since the class name is "ProductsController", the endpoint would be "/Products" or "/products" (case insensitive). If you created a similar controller page named "FooController.cs", the routing to that page would be "/Foo" or "/foo".

Add Your 2 Cents