Creating my first ASP.NET Core Web API
Published: 2021-04-21 16:25:59

As an Electrical & Electronic Engineering graduate, I finally decided to begin a new journey in the software development world. Although I have beginner knowledge of a few programming languages, frameworks and popular software engineering practices, I would say my learning was not structured.

My first step in this new journey is to learn ASP.NET Core development, and I'm eager to see what it has to offer! In this post, I will describe my first experience with the ASP.NET Core framework using the [Microsoft Docs tutorial](https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio). I have also included links to key concepts and resources.

![Why](http://stevewasserman.co.uk/wp-content/uploads/2020/05/1_yzgJ-66YvsokIvqw93jiJQ-300x128.png "Why?") 
###First of all, why ASP.NET Core?
ASP.NET Core is a web development framework based on C# that supports multiple platforms such as Windows, Linux and macOS. Being an open source framework, it is very flexible to work with.
This framework features an [MVC architecture](https://www.tutorialspoint.com/mvc_framework/mvc_framework_introduction.htm); Model, View, Controller; which makes it really easy to customize web applications and test APIs [(Application Programming Interfaces)](https://careers.upwork.com/blogs/startup-resources-upwork-blog/what-is-an-api-and-how-does-it-work). APIs are gateways that enable applications communicate with each other. 
As I keep working with the framework, I hope to learn more about its usefulness and advantages over other frameworks.

###Now, to the process!
![Typing](https://media.giphy.com/media/YAnpMSHcurJVS/giphy.gif)
After installing the .NET [Software Development Kit](https://clevertap.com/blog/what-is-an-sdk/) (SDK) and getting my Visual Studio Code ready with the C# extension, I was set to start.
Using the integrated terminal in Visual Studio Code, I created a new web API project. One thing I liked was that the new project came with a template that helped give a clearer understanding of how the API worked and was structured.

To develop my API, which was a to-do list tracker,  I created my database model and a database context that was set up to use an in-memory database. I then scaffolded the controller to enable it respond to web API requests using [CRUD](https://www.codecademy.com/articles/what-is-crud) (Create, Read, Update and Delete) operations quickly and asynchronously. [Scaffolding](https://www.dotnettricks.com/learn/mvc/understanding-aspnet-mvc-scaffolding) is a technique used to generate code for CRUD methods to be used to GET, POST, PUT and DELETE data in the database efficiently. 
I included a [Data Transfer Object](https://www.infoworld.com/article/3562271/how-to-use-data-transfer-objects-in-aspnet-core-31.html) (DTO) model which controls the properties that are returned to the client, and prevents over-posting. Apart from security, the DTO is useful for reducing payload size.

I thoroughly enjoyed the process of creating my first .NET CORE project, and I'm looking forward to exploring its functionality even more.
In my subsequent tasks, I will be optimizing the performance of the API.
Hope you enjoyed this read.! Like and comment :).