31
Rest v/s 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 !
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 !
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
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.
31