-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
ASP.NET Core 9 Essentials
By :
Controller-based projects are another way to deliver APIs using ASP.NET Core 9. This project type also implements the Model-View-Controller (MVC) pattern, which we learned about in Chapter 2.
The controller-based approach has a more complete and robust structure to deliver any type of API, so it supports different business contexts. In the same way as minimal APIs, it is possible to extend API functionalities by adding different types of configurations and customizations.
To create a controller-based API, you just need to type the following code in the terminal, in a directory of your choice:
dotnet new webapi -n ProductMVC -controllers true
This command uses the webapi template, which by default creates a minimal API project. In this case, we are adding a -controllers argument to state that a web API should be created using the controller-based approach.
As we can see in Figure 3...