Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/safaiyeh/fetch-graphql

Super simple GraphQL fetch client
https://github.com/safaiyeh/fetch-graphql

aws-appsync fetch fetch-api graphql javascript

Last synced: about 1 month ago
JSON representation

Super simple GraphQL fetch client

Awesome Lists containing this project

README

        

# fetch-graphql
Super simple GraphQL fetch client

## Installing
`yarn add fetch-graphql`

## Usage
```javascript

import fetchGraphQL from 'fetch-graphql';
const query = `
query getAllUsers {
listAllUsers {
items {
uid
}
}
}
`;
const variables = `
{
"createUser": {
"uid": "Safaiyeh"
}
}
`
const data = await fetchGraphQL(
'https://yourAPI.com/graphql',
query,
variables,
{ 'header1': 'headerValue1', ...headers }
);

```

## AWS AppSync
Pass your API Key to x-api-key header
```javascript
const headers = {
'x-api-key': ''
}
```