Open rajinder-yadav opened 5 years ago
I've got this to work using Postman, however the following code generates a JSON parse error?
const graphql = require('graphql.js'); const graph = graphql('https://api.github.com/graphql', { method: "POST", headers: { "User-Agent": "node", "Authorization": "Bearer <github-token>" } }); const query = graph(`query { viewer { login name } }`); query().then( res => console.log(JSON.stringify(res)), err => console.error(err) );
{ message: 'Problems parsing JSON', documentation_url: 'https://developer.github.com/v4' }
You can generate your token here: https://github.com/settings/tokens
I've got this to work using Postman, however the following code generates a JSON parse error?
Code
Error