# kikstart-graphql-client

> Small NodeJS Wrapper around apollo-client that provides easy access to running queries, mutations and subscriptions.

Latest version **1.5.0** (published 2020-04-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install kikstart-graphql-client
pnpm add kikstart-graphql-client
yarn add kikstart-graphql-client
bun add kikstart-graphql-client
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2020-04-17 |
| First published | 2019-11-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Bram Borggreve |
| Maintainers | beeman |
| Keywords | Hello, Greeter |

## Links

- npm: https://www.npmjs.com/package/kikstart-graphql-client
- Repository: https://github.com/beeman/kikstart-graphql-client
- Homepage: https://github.com/beeman/kikstart-graphql-client#readme
- Issues: https://github.com/beeman/kikstart-graphql-client/issues
- npm.io page: https://npm.io/package/kikstart-graphql-client

## Dependencies (11)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [apollo-link](https://npm.io/package/apollo-link.md) ^1.2.13
- [graphql-tag](https://npm.io/package/graphql-tag.md) ^2.10.1
- [apollo-client](https://npm.io/package/apollo-client.md) ^2.6.4
- [apollo-link-ws](https://npm.io/package/apollo-link-ws.md) ^1.0.19
- [apollo-link-http](https://npm.io/package/apollo-link-http.md) ^1.5.16
- [apollo-utilities](https://npm.io/package/apollo-utilities.md) ^1.3.2
- [apollo-link-error](https://npm.io/package/apollo-link-error.md) ^1.1.12
- [apollo-link-context](https://npm.io/package/apollo-link-context.md) ^1.0.19
- [apollo-cache-inmemory](https://npm.io/package/apollo-cache-inmemory.md) ^1.6.3
- [subscriptions-transport-ws](https://npm.io/package/subscriptions-transport-ws.md) ^0.9.16

## Recent versions

- 1.5.0 (latest) — 2020-04-17
- 1.4.0 — 2020-02-10
- 1.3.1 — 2019-11-25
- 1.3.0 — 2019-11-25
- 1.2.0 — 2019-11-25
- 1.1.0 — 2019-11-25
- 1.0.1 — 2019-11-23
- 1.0.0 — 2019-11-23

## README

# kikstart-graphql-client

Small NodeJS Wrapper around apollo-client that provides easy access to running queries, mutations and subscriptions. 


![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/beeman/kikstart-graphql-client.svg)
![GitHub repo size](https://img.shields.io/github/repo-size/beeman/kikstart-graphql-client.svg)
![npm](https://img.shields.io/npm/dw/kikstart-graphql-client.svg)
![npm](https://img.shields.io/npm/dm/kikstart-graphql-client.svg)
![npm](https://img.shields.io/npm/dy/kikstart-graphql-client.svg)
![npm](https://img.shields.io/npm/dt/kikstart-graphql-client.svg)
![NPM](https://img.shields.io/npm/l/kikstart-graphql-client.svg)
![npm](https://img.shields.io/npm/v/kikstart-graphql-client.svg)
![GitHub last commit](https://img.shields.io/github/last-commit/beeman/kikstart-graphql-client.svg)
![npm collaborators](https://img.shields.io/npm/collaborators/kikstart-graphql-client.svg)


## Usage

Install dependency:

```shell script
yarn add kikstart-graphql-client graphql
```

Import `GraphQLClient`:

```typescript
import { GraphQLClient } from 'kikstart-graphql-client';
```

Create instance:

```typescript
const client = new GraphQLClient({
  uri: 'http://localhost:4000/graphql',
  wsUri: 'ws://localhost:4000/graphql',
})
```

Run Query:

```typescript
async getStatus() {
  const { data, error } = await this.client.runQuery(`
    query { status }
  `);
  if (error) {
    throw error
  }
  return data.status
}
```

Run Subscription:

```typescript
client.runSubscription(query)
   .subscribe({
      next: res => console.log(JSON.stringify(res.data.statusSubscription, null, 2)),
      error: error => console.error(error),
      complete: () => console.log('done'),
   })
}
```



## Credits
- Uses code from [graphcurl](https://github.com/graphql-in-depth/graphcurl).
- Based on [npm-typescript-package-boilerplate](https://github.com/93v/npm-typescript-package-boilerplate)

## MIT License

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