Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/safaiyeh/fetch-graphql
- Owner: safaiyeh
- Created: 2019-12-10T04:48:08.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-16T16:50:41.000Z (about 1 year ago)
- Last Synced: 2024-10-04T13:17:59.762Z (about 1 month ago)
- Topics: aws-appsync, fetch, fetch-api, graphql, javascript
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fetch-graphql
Super simple GraphQL fetch client## Installing
`yarn add fetch-graphql`## Usage
```javascriptimport 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': ''
}
```