@unlikelystudio/simpleql
TypeScript icon, indicating that this package has built-in type declarations

1.3.0-beta.1 • Public • Published

SimpleQL

npm version

Minimal graphql client

Inspired by graphql-request by Prisma.

Getting started

npm i @unlikelystudio/simpleql
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.

interface Person {
  name: string
}

const query = await client.query<Person>({
  query,
})

Package Sidebar

Install

npm i @unlikelystudio/simpleql

Weekly Downloads

2

Version

1.3.0-beta.1

License

none

Unpacked Size

11.7 kB

Total Files

5

Last publish

Collaborators

  • antoninlanglade
  • baloran
  • bastienrobert