If you’ve read an article or even some brief description of GraphQL, it probably included a line about what it does better than REST and other APIs. Glancing over the question like that isn’t really fair though is it? You won’t get the whole picture without really looking at each API’s uses and advantages so let’s try to dig a bit into that here.
GraphQL is a flexible system for requesting data that focuses on pinpoint requests and delivering exactly what is required. What sets GraphQL apart from other APIs is its unique approach, it’s client-driven. Instead of handling it as usual (i.e. server to a client), where the client decides how everything is handled. The main benefits are:
The most well-known example of GraphQL application is probably GitHub. They switched to it in 2016 citing scalability and flexibility as the two major reasons. REST simply wasn’t cutting it for them, because it often required multiple requests to get the data you wanted and also over-fetched data on each of those requests. With GitHub’s rapid growth and user base in the tens of millions, you can imagine how big a concern that had to be. GraphQL provided exactly the alternative they needed because it’s focused on the client being able to request particular data in a specific format for a specific use.
#graphql #rest #devops #grpc