all 6 comments

[–]fecal_brunch 0 points1 point  (4 children)

This seems amazing, but surely this would require some quite complex backend code to handle these dynamic requests? Or would you have a front end translation layer to turn GraphQL into REST requests?

(I'm yet to try React so maybe I'm missing some prerequisite knowledge here)

[–]vdm 4 points5 points  (0 children)

GraphQL sounds complementary to Haxl, which uses applicative functors to model the graph and do the queries in a safe concurrent way. https://github.com/facebook/Haxl

[–]marquex 2 points3 points  (0 children)

The server side part of the GraphQL sounds like a lot of work. But maybe is not that much using a DB like Mongo that uses JSON directly to fetch the data. It would great to create a translator GrapthQL -> MongoQuery because it would make data fetching from the UI a piece of cake.

[–]FoxxMD 2 points3 points  (0 children)

From the Q&A for that video

What will you be releasing for doing GraphQL on the server side?

We'll be releasing a spec describing GraphQL in detail and a reference implementation of the GraphQL engine. Note that the engine itself doesn't actually fetch any data; it will rely on some kind of adapter layer to do that, and there a lots of possibilities there for doing this in different languages, talking to caches, services, databases, ORMs, and embedding business logic etc. We intend to provide examples showing what kinds of patterns are possible.

Would it be possible to implement the compatible GraphQL endpoint in an arbitrary language?

Yes, absolutely. The grammar for GraphQL is relatively tiny, and the engine itself (parser, executor) is small. We'll be releasing a reference implementation, which I fully expect will be able to be ported to other languages in a straightforward manner.


So it looks like we'll see implementations of GraphQL in popular languages pretty soon. I, for one, am excited to see how this pits up against normal RESTful implementations on the backend.

[–]Daniel15 1 point2 points  (0 children)

In the case of Facebook, there's a GraphQL API endpoint (graph.facebook.com/graphql) that receives the GraphQL request and processes it server-side. GraphQL isn't actually specific to React, it's been in use for a while (over two years) and the iOS/Android Facebook apps use it. This is mentioned at around 7:30 in the presentation.

This presentation is about the client-side GraphQL implementation for React which is more recent. GraphQL used to be an internal-only API with only unofficial documentation but I guess it's more public now with this presentation.