Hacker News new | ask | show | jobs
by HugoDaniel 3221 days ago
I can see the niche that GraphQL tries to fit in. But seriouslly, REST is much simpler and good enough for the huge majority of use cases.

Striking the middle ground there is also postgrest[0] and their queryable REST approach.

[0] https://postgrest.com/en/v4.1/

2 comments

GraphQL adds:

  * living documentation
  * much better approach to versioning/deprecation
  * type system
etc.

For REST based APIs you have to figure out all of these (and usually they are completely different accross projects/languages etc.).

Solutions like Swagger offer some sort of solution but they are still a PIA to work with.

This may be controversial, but I don't think REST is significantly simpler when implemented in a real project.

The setup for GraphQL takes longer than for REST because the ecosystem is still much younger, meaning you have to write some abstractions and helpers yourself. Once that's done, however, adding new types and new actions/mutations is about as hard in each and takes roughly the same amount of code. However, in GraphQL the maintenance cost from "hey, can you add X to the Y endpoint?" is dramatically reduced, and Apollo can save you from a lot of bugs by validating queries against the schema at compile time.