Skip to content

ariesjia/wechatmp-batch-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wechatmp-batch-graphql

Query Batching in Wechat Mini Program

Examples

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

// use yarn
yarn add wechatmp-batch-graphql
// use npm
npm install wechatmp-batch-graphql

License

MIT

Thanks

Heavily inspired by nanographql

About

tiny wechat mini program batch graphql client

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published