Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 11, 2021 10:52 pm GMT

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


Original Link: https://dev.to/mayank0508/rest-v-s-graphql-5bln

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To