Created
November 29, 2017 06:25
-
-
Save abustamam/3197af6a0349355e64372bb82b21224f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
`, | |
}) | |
.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