10 Reason to use GraphQL
Sarthak Shrivastava
2 years ago


Before going to the reasons to use GraphQL What exactly GraphQL is ??? 👇

1. What is GraphQL

An open-source query language created by Facebook

Alternative to the REST architecture

Only one endpoint to fetch all kinds of data from server-side

Operation is either a query (reading), mutation (writing), or subscription (continuous reading)

2. Less Time & Bandwidth

Uses single query call

Decreasing the number of network round trips to the server

Save waterfall network request

3. Strongly Typed Schema

Developers are getting many benefits that are unconceivable with schemaless APIs

GraphQL schemas can be written in the simple & expressive GraphQL Schema Definition Language (SDL)

Schema clearly defines the operations supported by the API

4. No Versioning needed

The resource URL or address remains the same

You can add new fields & deprecate older fields

The client receives a deprecation warning when querying a deprecated field

5. Easy documentation

Documentation for GraphQL API lives side by side with the code that contains it

Can generate accurate & up to date documentation for any changes

With GraphQL’s introspection feature, query the schema explore its contents & documentation

6. Amazing community

Initially when GraphQL was launched, the only doc was graphql-js

But now we have various languages & tonnes of GraphQL clients

Many small or big communities are using GraphQL in production

7. No Over-Fetching or Under-Fetching

With GraphQL, developers can fetch only what is required

Over-fetching happen when you only want one field but getting many

Under-fetching means not getting related field what we need

GraphQL query give exactly what you need

8. GraphQL is protocol agnostic

GraphQL does not depends on any HTTP methods or HTTP response codes

This makes GraphQL super simple to understand and use

It does not depends on any HTTP protocol

9. GraphQL Introspection

Introspection makes it possible to get GraphQL schema from the GraphQL API

It is best for auto generating API documentation

Introspection is best for mocking the GraphQL schema while testing

10. GraphQL is for all

It is an Open Specification rather than any software

Not tied to any language, environment or database

It decrease the code complexity with its simple queries

11. Liked this thread

Subscribe to my newsletter https://bitfumes.com/newsletters

Hit follow button for more content like this