An example consuming a GraphQL API from JavaScript using graphql.js.
MIT License
Example consuming a GraphQL API from JavaScript using graphql.js
.
https://codewithhugo.com/js-graphql-client-example/
$ npm install
$ node fetch.js
{
"pokemon": {
"attacks": {
"special": [
{
"name": "Discharge"
},
{
"name": "Thunder"
},
{
"name": "Thunderbolt"
}
]
}
}
}
Clone the repo
Install dependencies
$ npm install
Run using parcel:
$ npm start # or npx parcel index.html