10 Beyond REST

 

This chapter covers

  • Overview of some notable REST drawbacks
  • GraphQL introduction (pros and cons)
  • GraphQL implementation with HotChocolate
  • Overview of gRPC Remote Procedure Call (gRPC)
  • gRPC implementation with Grpc.AspNetCore
  • Other REST alternatives

As we’ve known since chapter 1, the REST architectural paradigm has been the most popular web API architecture for several years, thanks mostly to its scalability, flexibility, and portability, not to mention the huge adoption of the JavaScript Object Notation (JSON) data-exchange format by the IT world. But if we could take a closer look at all the REST web APIs in use nowadays, we’d likely see that only a fraction of them are RESTful. Most REST implementations adhere to only some of the guiding constraints defined by Roy Fielding which we reviewed in chapter 3 and have implemented throughout this book. Nonetheless, all of them have been developed with 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’re looking for simplicity, versatility, and performance—the top reasons why it has replaced SOAP almost everywhere. But it’s also important to understand that REST is not the only choice we have or even the best possible alternative in any given circumstance.

10.1 REST drawbacks

10.1.1 Overfetching

10.1.2 Underfetching

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

10.3.1 gRPC pros

10.3.2 gRPC cons

10.3.3 Installing the NuGet packages

10.3.4 Implementing the gRPC Server

sitemap