What is GraphQL?
GraphQL is an open-source query language that allows developers to consume, construct, and create APIs in their own unique way.
History of GraphQL
GraphQL was developed by Facebook in 2012 to address internal issues with their mobile applications. As an alternative to typical REST architecture, GraphQL became open-source in 2015. Consequently, because GraphQL makes data transfers more efficient, it reduced network usage for Facebook’s mobile applications drastically. Since then, GraphQL has attracted a large number of developers and is becoming increasingly popular for client-server communication.
Why adopt GraphQL?
Before discussing GraphQL, developers should be familiar with REST. One of REST’s disadvantages is that it can result in an excessive number of HTTP queries or too much data being fetched. GraphQL aims to improve upon REST philosophy by allowing developers to ask for a specific data instead of fetching a whole giant object. There is no room for errors like underfetching and overfetching with GraphQL. Finally, GraphQL allows developers to easily integrate with databases, JSON files, REST APIs and cloud services.
How GraphQL works under the hood?
A common GraphQL workflow can be seen below:
- First, a specific data is requested from the client via a query to GraphQL server.
- In order to get data, a function on the GraphQL server is invoked.
- Lastly, GraphQL server return the specific data requested by the client.
Who is using GraphQL?
GraphQL is used by a wide range of businesses, from large to small. Some bigger names include Airbnb, Lyft, GitHub, Twitter, Paypal, and Shopify. For more information, feel free to check out “Who’s using GraphQL?”.