Posts

Showing posts with the label web api

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...

End-to-End Image Upload with Azure Storage, AngularJS, and Web API

Image
A common feature in web applications is image upload. Images can be stored on disk, in the database, or in some other server. In this post we will take the third approach and store images using Azure Storage. We will also be using AngularJS on the front-end and Web API in the back-end.

Login with AngularJS and ASP.NET Web API

Image
When creating a non-Web API ASP.NET MVC project using Individual Accounts, the generated template makes use of Forms Authentication. When logging in using Forms Authentication, a cookie is stored on the client's machine and that cookie is included by the browser in each future request.