npm.io
2.1.0 • Published 1 year ago

@ryanccn/gql

Licence
MIT
Version
2.1.0
Deps
0
Size
6 kB
Vulns
0
Weekly
0
Stars
1

@ryanccn/gql

A tiny GraphQL querying library.

Installation

$ npm install @ryanccn/gql
$ yarn add @ryanccn/gql
$ pnpm add @ryanccn/gql

Usage

import { createGql } from "@ryanccn/gql";

const gql = createGql("https://countries.trevorblades.com/");

const { success, data } = await gql`
	query {
		continents {
			name
		}
	}
`();

If your GraphQL client is named something else, you can also do

import { createGql } from "@ryanccn/gql";

const gqlClient = createGql("https://countries.trevorblades.com/");

const { success, data } = await gqlClient.gql`
	query {
		continents {
			name
		}
	}
`();

to retain the DX benefits of the gql tag.

License

MIT

Keywords