TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Which is better: GraphQL vs. REST?

4 pointsby symboleproover 6 years ago

5 comments

mindcrimeover 6 years ago
I dunno, which is better, a screwdriver or a box-end wrench?<p>Which is better, peanut butter, or a jar of Gold Bond foot powder?
ponyousover 6 years ago
If your API is relatively straightforward (as in 1 service that just connects to a database), then you won&#x27;t profit from GraphQL as much. I see the biggest value of GraphQL when it&#x27;s put as an intermediate layer between the clients and multiple services in the backend.<p>Note: <i>clients</i> - plural, usually different clients need different data and doing it in REST would result in over fetching (fetching the data you don&#x27;t need)
Rjevskiover 6 years ago
GraphQL&#x27;s main advantage is better efficiency network-wise, as you only make one request to get all your data instead of several which is usually the case with REST when you have to fetch related resources.<p>If you&#x27;re targeting a mobile app, GraphQL can be a good option. If your API is purely for server-to-server communication, then don&#x27;t bother; it&#x27;s extra complexity for pretty much no gain.
nivertechover 6 years ago
The only intelligent answer to under-specified question is &quot;it depends&quot;.<p>If you want to decouple frontend development from backend development then go GraphQL route. For example i you have multiple different consumers for your backend, i.e. an SPA, a mobile app and a 3rd party API endpoint. Wuth REST you will have to write and maintain 3 different endpoints vs only one with GraphQL.
picturover 6 years ago
With proper use, every technology can be good.