Skip to content

Instantly share code, notes, and snippets.

@abustamam
Created November 29, 2017 06:25
Show Gist options
  • Save abustamam/3197af6a0349355e64372bb82b21224f to your computer and use it in GitHub Desktop.
Save abustamam/3197af6a0349355e64372bb82b21224f to your computer and use it in GitHub Desktop.
import { ApolloClient } from 'apollo-client'
import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory'
import gql from 'graphql-tag'
const client = new ApolloClient({
link: new HttpLink({ uri: 'https://graphql.example.com' }),
cache: new InMemoryCache()
})
client.query({
query: gql`
query AllUsers {
allUsers {
name
email
}
}
`,
})
.then(data => console.log(data))
.catch(error => console.error(error));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment