graphql-request-helper
Advanced tools
Comparing version 0.1.7 to 0.1.8
export * from './graphql-client'; | ||
export * from './models'; |
@@ -14,2 +14,3 @@ "use strict"; | ||
__exportStar(require("./graphql-client"), exports); | ||
__exportStar(require("./models"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "graphql-request-helper", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# graphql-request-helper | ||
Helper Class of Graphql Client | ||
## Getting Started | ||
Installing | ||
```bash | ||
@@ -11,28 +14,33 @@ $ npm install graphql-request-helper | ||
## Example | ||
```js | ||
import { GraphQLClient } from 'graphql-request-helper' | ||
import { GraphQLClient } from "graphql-request-helper"; | ||
``` | ||
Create Graphql Client | ||
```js | ||
const graphQLClient = new GraphQLClient('http://localhost:3000/api/graphql') | ||
const graphQLClient = new GraphQLClient("http://localhost:3000/api/graphql"); | ||
``` | ||
Performing a `Query` request | ||
```js | ||
const data = await graphQLClient.query({ | ||
queryName: 'getItems', | ||
fields: [ | ||
'id', | ||
{ | ||
name: 'shop', | ||
fields: ['name'] | ||
} | ||
], | ||
params: { | ||
page: 1 | ||
} | ||
}) | ||
queryName: "getItems", | ||
fields: [ | ||
"id", | ||
{ | ||
name: "shop", | ||
fields: ["id", "name"], | ||
}, | ||
], | ||
params: { | ||
page: 1, | ||
}, | ||
}); | ||
``` | ||
GraphQLClient receives the above fields and params and sends the following request | ||
```js | ||
@@ -44,2 +52,3 @@ query{ | ||
id | ||
name | ||
} | ||
@@ -51,2 +60,3 @@ } | ||
Performing a `Mutation` request | ||
```js | ||
@@ -57,4 +67,5 @@ // In ready. | ||
Catch an Error | ||
```js | ||
// In ready. | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55573
142
68