Web API Without Controller
If the mantra of "thin controllers, fat models" is followed to the extreme, it would result in very short controller methods, sometimes even only a couple of lines long. Today I am experimenting with doing away with controllers entirely, and just mapping routes directly to methods that execute the business logic. The code in this post can be found in: https://github.com/ojraqueno/web-api-without-controller Setting Up the New Project First, I created the web API project template using dotnet new : dotnet new webapi -n ControllerLessWebAPI That will create a new API project for me inside the ControllerLessWebAPI folder. I can run that project by going into the directory and running dotnet run : dotnet run It will start the website, which in my case is located in localhost port 5001. If I go to https://localhost:5001/weatherforecast , I can see some random JSON data being returned. Removing the Controller The starter template contains a WeatherControlle...