5 Creating a JSON API with minimal APIs

This chapter covers

  • Creating a minimal API application to return JSON to clients
  • Generating responses with IResult
  • Using filters to perform common actions like validation
  • Organizing your APIs with route groups

So far in this book you’ve seen several examples of minimal API applications that return simple Hello World! responses. These examples are great for getting started, but you can also use minimal APIs to build full-featured HTTP API applications. In this chapter you’ll learn about HTTP APIs, see how they differ from a server- rendered application, and find out when to use them.

Section 5.2 starts by expanding on the minimal API applications you’ve already seen. You’ll explore some basic routing concepts ...

Get ASP.NET Core in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.