GraphQL is a powerful API system based around declaring a schema describing the capabilities of your backend, and then querying that schema with a nice language that projects the data into the shape you want. But that’s just one way to use it. There are so many other uses for the GraphQL query language, especially for cases on the client where importing and running your whole GraphQL schema doesn’t make sense. Enter graphql-anywhere , the library that powers Apollo Client .
As you may recall, writing a GraphQL schema on the server requires you to declare a set of types with fields and resolvers. Since graphql-anywhere doesn’t use a schema, instead you can write just one resolver that is called for every field of the query:
(fieldName, rootValue, args, context, info) => any
Then, you can run this resolver with a GraphQL query like so:
import graphql from 'graphql-anywhere'
graphql(resolver, query)
#redux