0.0.1 • Published 2 years ago
@coatl/gql v0.0.1
@coatl/gql
A GraphQL client for Node.js (>=18) and the browser.
Features
- Zero dependencies
- Fully typed
- Queries
- Mutations
- Subscriptions (pending)
- File uploads (pending)
Installation
# using npm
npm install @coatl/gql
# using yarn
yarn add @coatl/gql
# using pnpm
pnpm add @coatl/gql
Usage
import GraphClient from '@coatl/gql';
const { query, mutate } = GraphClient('http://localhost:4000/graphql')
type UsersQuery = {
id: number
name: string
}
const { users } = await query<UsersQuery[], 'users'>(
`users {
id
name
}`
)
const { createUser } = await mutate<UsersQuery, 'createUser'>(
`createUser(name: $name){
id
name
}`
{ name: 'John Doe' }
)
0.0.1
2 years ago