Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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)