News for hackers. Stuff that matters.
Re:Ask HN: Which is better: GraphQL vs. REST? by mindcrime on Friday November 02, 2018 @11:38PM (#18368545)
I dunno, which is better, a screwdriver or a box-end wrench?

Which is better, peanut butter, or a jar of Gold Bond foot powder?

Re:Ask HN: Which is better: GraphQL vs. REST? by ponyous on Saturday November 03, 2018 @07:00AM (#18369630)
If your API is relatively straightforward (as in 1 service that just connects to a database), then you won't profit from GraphQL as much. I see the biggest value of GraphQL when it's put as an intermediate layer between the clients and multiple services in the backend.

Note: clients - plural, usually different clients need different data and doing it in REST would result in over fetching (fetching the data you don't need)

Re:Ask HN: Which is better: GraphQL vs. REST? by Rjevski on Saturday November 03, 2018 @02:11PM (#18371609)
GraphQL'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.

If you're targeting a mobile app, GraphQL can be a good option. If your API is purely for server-to-server communication, then don't bother; it's extra complexity for pretty much no gain.

Re:Ask HN: Which is better: GraphQL vs. REST? by nivertech on Saturday November 03, 2018 @01:56PM (#18371518)
The only intelligent answer to under-specified question is "it depends".

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.

Re:Ask HN: Which is better: GraphQL vs. REST? by pictur on Saturday November 03, 2018 @03:00AM (#18369091)
With proper use, every technology can be good.