Created
July 25, 2019 07:41
-
-
Save ayoubjamouhi/1ba5260c5f83ededada5824b9e9a7c62 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
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