3 ms·
GraphQL is a fine-grained resource protocol, and REST is a large-grained resource protocol. You don't want to serve thousands of 50 byte responses in REST just
by slver 5y ago
GraphQL is a fine-grained resource protocol, and REST is a large-grained resource protocol. You don't want to serve thousands of 50 byte responses in REST just to get what you need when your app opens, this is why GraphQL allows you to specify this in one response by selecting what you want in the query.
Can you implement this over REST? You can pretend you can, but if you put all those parameters in the URL and have countless ways of fetching the same data via infinite resource URLs, you're essentially bastardizing the concept of one URL one resource, or the idea that your entities each has its own URL, rather than inlining them in countless ways through one-off aggregate resources.
TLDR; REST really doesn't do what GraphQL does. And when you try to make REST do what GraphQL does, it ceases to be REST.