1.0.6 • Published 1 year ago

billymoor-graph-ql-second v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

GraphQL Client

A lightweight JavaScript package for making GraphQL queries to a specified endpoint URL.

Installation

npm install graphql-client

Usage

const GraphQLClient = require('graphql-client');

const client = new GraphQLClient('https://example.com/graphql');

const query = `
  query {
    posts {
      title
      body
    }
  }
`;

client.query(query)
  .then(data => console.log('Data:', data))
  .catch(error => console.error('Error:', error));

API

new GraphQLClient(url)

Creates a new GraphQL client instance with the specified GraphQL endpoint URL.

  • url (string): The URL of the GraphQL endpoint.

query(query, variables)

Executes a GraphQL query with optional variables.

  • query (string): The GraphQL query string.
  • variables (object, optional): The variables used in the query.

Returns a Promise that resolves with the query result.

License

This project is licensed under the MIT License - see the LICENSE file for details.

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago