https://github.com/ariesjia/wechatmp-batch-graphql
tiny wechat mini program batch graphql client
https://github.com/ariesjia/wechatmp-batch-graphql
batch-query graphql mini-program wechat
Last synced: 7 months ago
JSON representation
tiny wechat mini program batch graphql client
- Host: GitHub
- URL: https://github.com/ariesjia/wechatmp-batch-graphql
- Owner: ariesjia
- License: mit
- Created: 2018-10-16T04:44:14.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T15:20:14.000Z (about 3 years ago)
- Last Synced: 2025-06-10T12:47:17.061Z (7 months ago)
- Topics: batch-query, graphql, mini-program, wechat
- Language: JavaScript
- Homepage:
- Size: 258 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wechatmp-batch-graphql
> Query Batching in Wechat Mini Program
- [What is GraphQL?](https://graphql.org/)
- [Query batching in Apollo](https://blog.apollographql.com/query-batching-in-apollo-63acfd859862)
## Examples
```javascript
import { BatchGraphql, gql } from 'wechatmp-batch-graphql'
const graphql = new BatchGraphql({
uri: '/graphqls'
})
const query1 = gql`
query getProduct($id: ID!) {
node(id: $id) {
... on Product {
description
}
}
}
`
const query2 = gql`
query chineseRegions {
chineseRegions {
code
name
}
}
`
graphql.request(query1({
id: 'Z2lkOi8vUFJPRFDVC9OSzAwMTQ='
}))
graphql.request(query2())
// query1 and query2 it will send in one request
```
## Install
``` bash
// use yarn
yarn add wechatmp-batch-graphql
// use npm
npm install wechatmp-batch-graphql
```
## License
[MIT](http://opensource.org/licenses/MIT)
## Thanks
Heavily inspired by [nanographql](https://github.com/yoshuawuyts/nanographql)