4 ms·
Your second bullet point, "Only allow certain queries from a document store", seems to be a major, major limitation, and directly contrary to one of the princip
by hn_throwaway_99 8y ago
Your second bullet point, "Only allow certain queries from a document store", seems to be a major, major limitation, and directly contrary to one of the principal design goals of GraphQL.
- strken 8y agoYou could always run dynamic GraphQL in development, then switch to code generation and pre-registered queries in production. We've been looking at doing this as a way to lock down the API and stop potential DoS attacks more ruthlessly.
- syrusakbary 8y agoCompanies like Facebook limit the documents that can be queried against their GraphQL API this way. There are some major benefits of this: - improving the speed of the HTTP request (it always be faster to just send a documentId rather than a big query sting from the client side) - Control what is queried against your API (so there are no "Facebook" clones with some extra views) At the end, with enough tooling you can make the frontend projects upload their documents queries automatically as their developers work on it. So the tradeoffs for GraphQL APIs focused on internal products are not as bad.
- underwater 8y agoI don’t think Facebook is limiting the queries that can be run. Persisted queries are an optional optimisation on top of dynamic queries.
- CGamesPlay 8y agoI think it would be fine to implement a cache middleware that transparently registered new queries and assigned them an ID. I wonder if this is on the roadmap for v2.