From REST to GraphQL
blog.jacobwgillespie.com
From REST to GraphQL
1–10 of 46 posts
Re: From REST to GraphQL
#2Re: From REST to GraphQL
#3This sounds like incompetent back-end design in the initial REST API. I never thought GraphQL would be more performant than REST-API + optimized queries. I don't have any experience with the current set of GraphQL libraries, but I've assumed that GraphQL is a solution to a completely different set of issues but with a possible performance penalty.
It doesn't even qualify as REST. They've got hard-coded URI hierarchies and IDs everywhere. That's the opposite of REST.
REST APIs must be hypertext-driven: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hyperte...
Re: From REST to GraphQL
#4Mobile client-side caching and sync/refreshing (or client-side change push) is where users get big gains in perceived speed gains. Fielding's REST handles this well, in my experience, though it takes some work to get the resource granularity correct, especially as a mobile app's feature needs are changing.
In my experience it's often the case that the mobile app can benefit from Fielding's REST (with HATEOS) and from using resources that are mobile-specific and quite different than the out-of-the box server-side models that map 1:1 to database rows. As an example, the JSON API team describes how to nest resources efficiently and cacheably, and also send HATEOS links.
I'll be very interested to hear more about your next steps, including how you decide to do caching, puts, and any kind of pub/sub or equivalent. Thanks again!
Re: From REST to GraphQL
#5This sounds like incompetent back-end design in the initial REST API. I never thought GraphQL would be more performant than REST-API + optimized queries. I don't have any experience with the current set of GraphQL libraries, but I've assumed that GraphQL is a solution to a completely different set of issues but with a possible performance penalty.
> This sounds like incompetent back-end design in the initial REST API. It doesn't even qualify as REST. They've got hard-coded URI hierarchies and IDs everywhere. That's the opposite of REST. REST APIs must be hypertext-driven: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hyperte...
But yes, I agree, what is commonly called "REST" isn't usually.
Re: From REST to GraphQL
#6Re: From REST to GraphQL
#7Re: From REST to GraphQL
#8Terrific writeup - thanks for sharing. IMHO this is the most important item: "We have yet to solve caching GraphQL responses on the client." Mobile client-side caching and sync/refreshing (or client-side change push) is where users get big gains in perceived speed gains. Fielding's REST handles this well, in my experience, though it takes some work to get the resource granularity correct, especially as a mobile app's…
I will definitely follow up with our findings as we progress towards solving our remaining challenges.
Re: From REST to GraphQL
#9It's great that GraphQL's solved some of your issues, and you've encouraged me to look into it a bit more. One thing you should worry about, though - if at any point there's any user-specific data in an HTTP response that doesn't have the user's ID in the URL (or something pointed to by the 'vary' header), it kills the idempotence of the request, whether you're using what Rails gives you or GraphQL or XML-RPC or what…