fetch-graphql
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

fetch-graphql

Super simple GraphQL fetch client

Installing

yarn add fetch-graphql

Usage

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

const headers = {
  'x-api-key': '<AWS KEY HERE>'
}

Readme

Keywords

none

Package Sidebar

Install

npm i fetch-graphql

Weekly Downloads

5

Version

0.2.0

License

MIT

Unpacked Size

1.6 kB

Total Files

4

Last publish

Collaborators

  • safaiyeh