# graphql-fetch

> Thin GraphQL client powered by fetch

Latest version **1.0.1** (published 2016-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphql-fetch
pnpm add graphql-fetch
yarn add graphql-fetch
bun add graphql-fetch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-12-29 |
| First published | 2016-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Tejesh Mehta |
| Maintainers | tjmehta |
| Keywords | graphql, client, fetch, request, query, mutation |

## Links

- npm: https://www.npmjs.com/package/graphql-fetch
- Repository: https://github.com/tjmehta/graphql-fetch
- Issues: https://github.com/tjmehta/graphql-fetch/issues
- npm.io page: https://npm.io/package/graphql-fetch

## Dependencies (2)

- [101](https://npm.io/package/101.md) ^1.5.0
- [isomorphic-fetch](https://npm.io/package/isomorphic-fetch.md) ^2.2.1

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-12-29
- 1.0.0 — 2016-06-03

## README

# graphql-fetch [![Build Status](https://travis-ci.org/tjmehta/graphql-fetch.svg?branch=master)](https://travis-ci.org/tjmehta/graphql-fetch) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
Thin GraphQL client powered by fetch.

# Installation
```bash
npm i --save graphql-fetch
```

# Usage
```js
var fetch = require('graphql-fetch')('http://domain.com/graphql')

var query = `
  query q (id: String!) {
    user(id: $id) {
      id,
      email,
      name
    }
  }
`
var queryVars = {
  id: 'abcdef'
}
var opts = {
  // custom fetch options
}

/**
 * @param  {Query} query graphql query
 * @param  {Object} [vars]  graphql query args, optional
 * @param  {Object} [opts]  fetch options, optional
 */
fetch(query, queryVars, opts).then(function (results) {
  if (results.errors) {
    //...
    return
  }
  var user = result.data.user
  //...
})
```

# Notes
* Uses [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) under the hood, which makes `fetch`, `Headers`, `Request`, and `Response` globally available.

# License
MIT

---
_Source: https://npm.io/package/graphql-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
