@tiny-graphql/core

v0.0.1
A tiny GraphQL suite for making your dev experience better than ever.

Tiny GraphQL Core core

A tiny GraphQL client for making your dev experience better than ever.

Usage

import { createClient } from '@tiny-graphql/core';

const client = createClient({
  url: '<YOUR_URL>'
});

async function sayHello(name: string): string {
  const result = await client.execute<{ hello?: string }>({
    query: `
      query SayHello($name: String) {
        hello(name: $name)
      }
    `,
    variables: {
      name: 'World'
    }
  });

  if (result.errors || !result.data) {
    throw new Error('Could not say hello');
  }

  return result.data.hello;
}
npm i @tiny-graphql/[email protected]

Metadata

  • MIT
  • >=8.9
  • Unknown
  • released 9/22/2019

Downloads

Maintainers