Skip to content

Bbanez/graphql-client

Repository files navigation

GraphQL Client

NPM Version

This project is a simple and easy GraphQL client based on project created by nordsimon. Is far as I was able to see this package is not maintained any more and it does not provide types. Since I personally liked it for its simplicity, small footprint and ease of use, I decided to refactor it and move it to typescript. I hope that you will find it useful.

Usage

const graphql = createGraphQLClient({
  url: 'https://api.spacex.land/graphql/',
});

const result = await graphql<{
  ships: Array<{
    name: string;
    image: string;
  }>;
}>(
  `
    query ($limit: Int!) {
      ships(limit: $limit) {
        name
        image
      }
    }
  `,
  {
    limit: 10,
  },
);

console.log(result);

About

Simple and easy GraphQL client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published