Ask HN: Which is better: GraphQL vs. REST? |
Ask HN: Which is better: GraphQL vs. REST? |
Which is better, peanut butter, or a jar of Gold Bond foot powder?
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)
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.
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.