Rest v/s GraphQL !

mayank0508

Mayank Kumar

Posted on July 11, 2021

Rest v/s GraphQL !

First of all let me tell you what is a Rest and GraphQL !

REST(Representational State Transfer) and GraphQL are two API design styles that serve the same purpose: transferring data over internet protocols including HTTP. However, REST is an architectural pattern, whereas GraphQL is a query language

1) Rest has Multiple End points, where as GraphQL has one endpoint !

image

2) Both generally give the Data back in JSON format
image

3) Both are Stateless:
Statelessness means that every HTTP request happens in complete isolation. When the client makes an HTTP request, it includes all information necessary for the server to fulfill that request. The server never relies on information from previous requests.

4) Rest APIs are more flexible, whereas GraphQL only works with POST !

image

5) In GraphQL you can be more detailed about the kind of data you want to fetch, but thing is not applicable in REST APIs as it fetches all the data available

image

6) In REST because of its tendency to pull all the data it brings a huge amount of data which is unnecessary to the client !

In total in my opinion both have their own benefits, if you are new to APIs, then go with REST APIs
If you are running a massive project then go for GraphQL.

image

πŸ’– πŸ’ͺ πŸ™… 🚩
mayank0508
Mayank Kumar

Posted on July 11, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related