Hacker News new | ask | show | jobs
by ttfkam 1104 days ago
As a frontend developer, GraphQL is substantially better: fewer calls, hierarchy preserved, and no excess data over the wire.

As a backend developer, REST is substantially simpler to implement: HTTP endpoint is dead simple and the caching models are 30 years old (aka very well-defined).

The answer is definitely going to be skewed by what kind of developer you ask.

For backend, writing a GraphQL server by hand (schema, types, and resolvers) is a PITA. If you have a generator like Postgraphile or Hasura, it's almost a no-brainer how easy it is. REST by comparison is almost always dead simple to reason about no matter the tooling, and literally everyone already knows how it works.

As a frontend developer, I have never said to myself, "Gee! I'm sure glad I have to call these five separate REST endpoints with a bunch of extra data I'll never use just to render this one web page." I have split GraphQL calls into separate requests, but only for performance optimization in specific cases.

REST gives backend more power. GraphQL gives frontend more power. If you're like most shops, backend doesn't fully trust frontend and are kind of lazy in an anal retentive kind of way. If you're like Netflix, you've got so many different clients that supporting all variations of REST was simply unmaintainable, so GraphQL really was their only sane path forward.

Then of course there's gRPC, but I still consider that a serialization optimization rather than a real paradigm difference.