Skip to content

Instantly share code, notes, and snippets.

@lucasconstantino
Created March 29, 2017 18:22
Show Gist options
  • Save lucasconstantino/a550d59c188b9403414d29d8b1a11262 to your computer and use it in GitHub Desktop.
Save lucasconstantino/a550d59c188b9403414d29d8b1a11262 to your computer and use it in GitHub Desktop.
import ApolloClient, { printAST } from 'apollo-client'
import { graphql } from 'graphql'
import { schema } from './schema'
export const client = new ApolloClient({
networkInterface: {
query: req => {
const query = printAST(req.query)
const { operationName, variables = {} } = req
return graphql(schema, query, null, null, variables, operationName)
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment