The advantages of using GraphQL are enormous. Below are a few of them.

1. Same API can be used by multiple clients as we can conditionally query the necessary data from an API.

2. Reduced data usage by the client as only required data is transferred from the server.

3. Backend API is not tightly coupled with where it is used.

But one of the most important advantages from a backend perspective is the following:

Reduced processing by the backend server based on the client’s query.

Note that this is not something that is provided out of the box by GraphQL. If you do not code it the right way, then the load on your backend server will always be the same irrespective of the client’s query.

That is, you should not write code in the same way you would write a REST endpoint.

#graphql #rest #developer

Do Not Resolve Your GraphQL Fields like a REST Endpoint
1.85 GEEK