From the course: Advanced Web APIs with ASP.NET Core 8

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Working with minimal APIs

Working with minimal APIs

- [Instructor] So far, we've been using a controller class-based API. So we had action methods in our product controller, but there's also minimal API in our project in Program.cs. Now, when migrating our implementation so far to that model, it looks simple at first, but there is a catch and I definitely wanted to show you that. I went to the definition of the /products endpoint, which returns our products. And then I essentially pasted the implementation we have implemented so far here. However, you already see the red squiggly line. That doesn't really work because in that specific case, in order to allow ASP.NET Core Web API to bind the data from the URL to the ProductQueryParameters instance, we have to give some extra pointers because we are also providing the ShopContext here as a method argument. We would need to implement the TryParse method in our ProductQueryParameters class and probably also in the QueryParameters class. Of course, we could do that. But starting with .NET…

Contents