0.0.0-semantic-release • Published 5 years ago
shopify-graphql-node v0.0.0-semantic-release
shopify-graphql-node
Shopify GraphQL for 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
Customize fetcher
Issue
If you have any issue or question, please create new issue
License
This project is licensed under the MIT License.