https://github.com/unlikelystudio/simpleql
📚 Simple graphql client
https://github.com/unlikelystudio/simpleql
fetch graphql graphql-client typescript
Last synced: 5 months ago
JSON representation
📚 Simple graphql client
- Host: GitHub
- URL: https://github.com/unlikelystudio/simpleql
- Owner: unlikelystudio
- Created: 2020-07-01T22:41:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-21T10:03:45.000Z (almost 3 years ago)
- Last Synced: 2025-03-17T01:18:24.442Z (over 1 year ago)
- Topics: fetch, graphql, graphql-client, typescript
- Language: TypeScript
- Homepage:
- Size: 338 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
SimpleQL
Minimal graphql client
_Inspired by [graphql-request](https://github.com/prisma-labs/graphql-request) by Prisma._
## Getting started
```bash
npm i @unlikelystudio/simpleql
```
```typescript
import SimpleQL from '@unlikelystudio/simpleql'
import gql from 'graphql-tag'
const client = new SimpleQL('https://api.unlikely.studio')
const query = `
query Projects {
projects(first: 3) {
edges {
node {
title
description
image {
src
width
height
}
}
}
}
}
`
// OR
const query = gql`
query Projects {
projects(first: 3) {
edges {
node {
title
description
image {
src
width
height
}
}
}
}
}
`
const query = await client.query({
query,
})
```
### Typescript users
You can add types to your query response.
```typescript
interface Person {
name: string
}
const query = await client.query({
query,
})
```