Overview — REST APIs with ASP.NET Core API

In Chapter 3Creating a Web Server with ASP.NET Core, you saw how to create a basic ASP.NET Core MVC application that can be broken down into three layers: models, controllers, and views. RESTful APIs in ASP.NET Core work very similarly; the only difference is that, instead of returning responses as visual views, the API response is a payload of data (usually in JSON format). The data returned from the API is later consumed by clients, such as Angular-based applications that can render the data as views, or by headless clients that have no UI and simply process data. (More information on headless clients can be found at https://en.wikipedia.org/wiki/Headless_software.) For example, consider a background process that periodically sends notifications to a user about their account status:

Before ASP.NET Core, Microsoft created an explicit distinction between ASP.NET MVC and the ASP.NET Web API. The former was used to create web applications with views that are generated by the server, while the former was used to create services that contain only logic and can be consumed by any client. Over time, the distinction between the two frameworks caused duplication of code and added a burden on the developers who needed to learn and master two technologies. ASP.NET Core unified the two frameworks into the ASP.NET Core MVC suite, and made it simpler to create web applications, with or without visual responses.

Let's start with a simple API that will be the foundation for our GiveNTake application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.27.171