Skip to content

Instantly share code, notes, and snippets.

@ayoubjamouhi
Created July 25, 2019 07:41
Show Gist options
  • Save ayoubjamouhi/1ba5260c5f83ededada5824b9e9a7c62 to your computer and use it in GitHub Desktop.
Save ayoubjamouhi/1ba5260c5f83ededada5824b9e9a7c62 to your computer and use it in GitHub Desktop.
require('dotenv').config();
const gql = require('graphql-tag');
const ApolloClient = require('apollo-boost').ApolloClient;
const fetch = require('cross-fetch/polyfill').fetch;
const createHttpLink = require('apollo-link-http').createHttpLink;
const InMemoryCache = require('apollo-cache-inmemory').InMemoryCache;
const client = new ApolloClient({
link: createHttpLink({
uri: process.env.API,
fetch: fetch
}),
cache: new InMemoryCache()
});
client.mutate({
mutation: gql`
mutation popJob {
popJob {
id
type
param
status
progress
creation_date
expiration_date
}
}
`,
}).then(job => {
console.log(job);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment