In the previous five chapters, you’ve worked through each layer of a server-side rendered ASP.NET Core application, using Razor Pages to render HTML to the browser. In this chapter you’ll see a different take on an ASP.NET Core application. Instead of using Razor Pages, we’ll explore Web APIs, which serve as the backend for client-side SPAs and mobile apps.
You can apply much of what you’ve already learned to Web APIs; they use the same MVC design pattern, and the concepts of routing, model binding, and validation all carry through. The differentiation from traditional web applications is primarily in the view part of MVC. Instead of returning HTML, they return data as JSON or XML, which client applications use to control their behavior or update the UI.