用于 graphql-ruby 的持久化查询
GraphQL::PersistedQueries is the implementation of persisted queries for graphql-ruby. With this plugin your backend will cache all the queries, while frontend will send the full query only when it's not found at the backend storage.
Used in production by:
Need help with your GraphQL API architecture, schema design, or performance? I'm available for consulting — get in touch.
First of all, install and configure apollo's persisted queries on the front–end side:
import { HttpLink, InMemoryCache, ApolloClient } from "@apollo/client";
import { createPersistedQueryLink } from "@apollo/client/link/persisted-queries";
import { sha256 } from 'crypto-hash';
const httpLink = new HttpLink({ uri: "/graphql" });
const persistedQueriesLink = createPersistedQueryLink({ sha256 });
const client = new ApolloClient({
cache: new InMemoryCache(),
link: persistedQueriesLink.concat(httpLink);
});Add the gem to your Gemfile gem 'graphql-persisted_queries' and add the plugin to your schema class:
class GraphqlSchema Read more about the gem internals: [Persisted queries in GraphQL:
Slim down Apollo requests to your Ruby application](https://evilmartians.com/chronicles/persisted-queries-in-graphql-slim-down-apollo-requests-to-your-ruby-application)
## Credits
Initially sponsored by [Evil Martians](http://evilmartians.com).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/DmitryTsepelev/graphql-ruby-persisted_queries.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).暂无开放 Issues,或尚未同步最近议题。