const fetch = require('node-fetch');
const ENDPOINT = 'http://api.cognitiveops.me/graphql';
function sendQuery(payload) {
return fetch(ENDPOINT, {
method: 'POST',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify(payload),
}).then(res => {
return res.json();
});
}
const payload = {
query: `
query {
clients {
id
}
}`,
};
sendQuery(payload)
.then((res) => {
console.log('!!!-!!!-!!! res {04.10.2019-9:01}\n', res); //del
})
.catch((err) => {
console.log('!!!-!!!-!!! err {04.10.2019-9:01}\n', err); //del
});