Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hugodf/js-graphql-client-example
An example consuming a GraphQL API from JavaScript using graphql.js.
https://github.com/hugodf/js-graphql-client-example
github-pages graphql-client graphql-js javascript parcel-bundler
Last synced: 2 months ago
JSON representation
An example consuming a GraphQL API from JavaScript using graphql.js.
- Host: GitHub
- URL: https://github.com/hugodf/js-graphql-client-example
- Owner: HugoDF
- License: mit
- Created: 2018-08-06T10:56:57.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-02T05:00:37.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T12:11:49.761Z (3 months ago)
- Topics: github-pages, graphql-client, graphql-js, javascript, parcel-bundler
- Language: HTML
- Homepage: https://hugodf.github.io/js-graphql-client-example
- Size: 478 KB
- Stars: 1
- Watchers: 2
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript GraphQL Example
Example consuming a GraphQL API from JavaScript using `graphql.js`.
## See it live
[https://codewithhugo.com/js-graphql-client-example/](https://codewithhugo.com/js-graphql-client-example/)
## Run Node script
```sh
$ npm install
``````sh
$ node fetch.js
{
"pokemon": {
"attacks": {
"special": [
{
"name": "Discharge"
},
{
"name": "Thunder"
},
{
"name": "Thunderbolt"
}
]
}
}
}
```## Run client-side app
### Locally
- Clone the repo
- Install dependencies
```sh
$ npm install
```- Run using parcel:
```sh
$ npm start # or npx parcel index.html
```- Open [http://localhost:1234](http://localhost:1234)