0.2.0 • Published 10 months ago

weapp-graphql-request v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

weapp-graphql-request (WIP)

Forked from graphql-request

Minimal GraphQL client supporting weapp environment.

Install

npm i weapp-graphql-request weapp-fetch graphql

Quick Start

import { GraphQLClient } from 'weapp-graphql-request'
import { createFetch } from 'weapp-fetch'
// const weappFetch = createFetch(wx.request)
// const uniFetch = createFetch(uni.request)
// const taroFetch = createFetch(taro.request)
// etc..
const graphQLClient = new GraphQLClient('http://localhost:3000', {
  fetch: weappFetch,
})

graphQLClient.request(query, variables).then((data) => console.log(data))

you should install weapp-fetch instead of other fetch implement because only this lib can run in weapp environment.

Environment support

weappalipayswanttqqjdquickapp
??????

Framework support

uni-apptaroothers
?

Usages

Refers to graphql-request

You can read it's doc for usage, but there are some points not support.

  1. File upload, weapp has no Blob/File/FormData class.
import { GraphQLWebSocketClient } from 'weapp-graphql-request'
const task = wx.connectSocket({
  url: 'wss://example.qq.com',
  header: {
    'content-type': 'application/json',
  },
  protocols: ['protocol1'],
})

const wsClient = new GraphQLWebSocketClient(task, { onInit, onAcknowledged, onPing, onPong })
0.2.0

10 months ago

0.2.0-alpha.0

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago