shopify-graphql-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-semantic-release • Public • Published

shopify-graphql-node

Installation

To install this package, you can run command

npm install --save shopify-graphql-node

Or

yarn add shopify-graphql-node

Usage

  • Simple query
import GraphQL from "shopify-graphql-node";
 
const GraphQLClient = new GraphQL("domain", "access-token");
 
const query = `query { shop { id } }`;
 
GraphQLClient
  .request(query)
  .then(data => console.log(JSON.stringify(data.shop, null, 2)))
  .catch(error => console.log(JSON.stringify(error, null, 2)));
 
  • Simple mutation
import GraphQL from "shopify-graphql-node";
 
const GraphQLClient = new GraphQL("domain", "access-token");
 
const mutation = `
  mutation collectionCreate($input: CollectionInput!) {
    collectionCreate(input: $input) {
      collection {
        id
      }
    }
  }
`;
 
GraphQLClient
  .request(mutation, {
    input: {
      descriptionHtml: "Collection was created from GraphQL",
      title: "GraphQL Collection",
    },
  })
  .then(data => console.log(JSON.stringify(data, null, 2)))
  .catch(error => console.log(JSON.stringify(error, null, 2)));
 
  • For more example, please read here

Issue

If you have any issue or question, please create new issue

License

This project is licensed under the MIT License.

Contributors

Todo

Readme

Keywords

Package Sidebar

Install

npm i shopify-graphql-node

Weekly Downloads

51

Version

0.0.0-semantic-release

License

MIT

Unpacked Size

3.91 kB

Total Files

4

Last publish

Collaborators

  • roanvanbao