https://github.com/ryanccn/gql
A tiny GraphQL querying library
https://github.com/ryanccn/gql
fetch-api graphql graphql-client javascript typescript
Last synced: 4 months ago
JSON representation
A tiny GraphQL querying library
- Host: GitHub
- URL: https://github.com/ryanccn/gql
- Owner: ryanccn
- License: mit
- Created: 2023-05-24T06:39:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-27T00:44:01.000Z (9 months ago)
- Last Synced: 2024-09-28T21:21:48.935Z (9 months ago)
- Topics: fetch-api, graphql, graphql-client, javascript, typescript
- Language: TypeScript
- Homepage:
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @ryanccn/gql
A tiny GraphQL querying library.
## Installation
```console
$ npm install @ryanccn/gql
$ yarn add @ryanccn/gql
$ pnpm add @ryanccn/gql
```## Usage
```typescript
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
```typescript
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