Introduction to GraphQL
GraphQL
is open source query language
Β for API, and a runtime for fulfilling those queries with your existing data. It was developed by Facebook
, and released publicly in 2015
.
It is considered to be more efficient, powerful and flexible alternate to REST and ad-hoc web service architecture.
GraphQL
is revolutionary way of writing the APIs, and it is not attached to any specific database.
Alternate to REST
and ad-hoc web servcice
, Why?
Why GraphQL
is considered as alternate to REST
and other ad-hoc
web services
? Because there is a major difference, how both works in client-server architecture. In REST API
, client deals with the rigid server-side endpoints, server structured the data, and same data is returned to the client. Whereas, in GraphQL
, client defines the structure of data, and server returns the same structure of data. So, GraphQL
gives the power to the client.
These are the strong reasons, why GraphQL is considered alternate to REST
APIs. These are following:
- Efficient data loading on mobile devices
The prime reason for developing GraphQL by Facebook was for heavy data usage, low powered device and slow network. GraphQL only transfer minimum amount of data over the wire required for any application or device, and improve the device and application performance.
- Perfect for faster development and rapid change environment
GraphQL
is perfect for environment where continuous deployments, frequent iterations and requirements changes happens in companies. These factors impact the rigid server-side REST APIs design, and hard to modify on frequent changes.
- Perfectly suitable for varieties of frontend frameworks
With REST APIs
, it is very hard to maintain one API end-point to fulfill the various client-end requests. But this can be achieved with GraphQL
.
Growing Power of GraphQL
GraphQL
power is growing day by day, and lot of companies adopted the GraphQL
. Here are few big players of GraphQL
Summary
In this blog, we read about GraphQL and how it is future query language as compared to REST.
Read more: