Building Web APIs with ASP.NET Core cover
welcome to this free extract from
an online version of the Manning book.
to read more
or

10 Beyond REST

 

This chapter covers

  • Overview of some REST notable drawbacks
  • GraphQL introduction (pros and cons)
  • Implementing GraphQL using HotChocolate
  • Overview of Google Remote Procedure Call (gRPC)
  • Implementing a gRPC server and client using Grpc.AspNetCore
  • Other REST alternatives

As we know since Chapter 1, the REST architectural paradigm has been the most popular Web API architecture for several years, mostly thanks to its scalability, flexibility, and portability – not to mention the huge adoption of the JSON data exchange format by the IT world.

However, if we could take a closer look at all the REST Web APIs in use nowadays, we could likely see how only a fraction of them is actually RESTful. As a matter of fact, most REST implementations only adhere with some of the guiding constraints defined by Roy Fielding which we reviewed back in Chapter 3 and then implemented throughout this book. Nonetheless, all of them have been developed having the REST standard in mind.

This indisputable success is more than justified: when it comes to designing and implementing a web service, REST is almost always a great choice, especially if we are looking for simplicity, versatility, and performance – the top reasons why it has replaced SOAP almost everywhere. However, it’s also important to understand that REST is not the only choice we have, nor the best possible alternative in any given circumstance.

10.1 REST drawbacks

10.1.1 Over-fetching

10.1.2 Under-fetching

10.2 GraphQL

10.2.1 GraphQL advantages

10.2.2 GraphQL drawbacks

10.2.3 Implementing GraphQL

10.2.4 Working with GraphQL

10.3 Google Remote Procedure Call (gRPC)

10.3.1 gRPC pros

10.3.2 gRPC cons

10.3.3 Installing the NuGet packages

10.3.4 Implementing the gRPC Server

10.3.5 Implementing the gRPC client

10.3.6 Adding Authorization support

10.4 Other REST alternatives

10.4.1 Newline Delimited JSON (NDJSON)

10.4.2 Falcor

10.4.3 Thrift

10.5 Exercises

sitemap