All Projects → Authing → Wxapp Graphql

Authing / Wxapp Graphql

📱A GraphQL client for 微信小程序

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Wxapp Graphql

Webtau
Webtau (short for web test automation) is a testing API, command line tool and a framework to write unit, integration and end-to-end tests. Test across REST-API, Graph QL, Browser, Database, CLI and Business Logic with consistent set of matchers and concepts. REPL mode speeds-up tests development. Rich reporting cuts down investigation time.
Stars: ✭ 156 (-6.59%)
Mutual labels:  graphql
Vendure
A headless GraphQL ecommerce framework for the modern web
Stars: ✭ 2,961 (+1673.05%)
Mutual labels:  graphql
Graphql Transform Federation
Convert your existing GraphQL schema into a federated schema
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Dataloader Php
DataLoaderPhp is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.
Stars: ✭ 160 (-4.19%)
Mutual labels:  graphql
Cms Mobile
A flutter project for amfoss cms
Stars: ✭ 162 (-2.99%)
Mutual labels:  graphql
Graphql Builder
GraphQL client library for Clojure and ClojureScript
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Ferry
Stream-based strongly typed GraphQL client for Dart
Stars: ✭ 160 (-4.19%)
Mutual labels:  graphql
Cppgraphqlgen
C++ GraphQL schema service generator
Stars: ✭ 166 (-0.6%)
Mutual labels:  graphql
Wp Graphql Gutenberg
Query gutenberg blocks with wp-graphql
Stars: ✭ 158 (-5.39%)
Mutual labels:  graphql
Workshops
Workshops organized to introduce students to security, AI, AR/VR, hardware and software
Stars: ✭ 162 (-2.99%)
Mutual labels:  graphql
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (-4.19%)
Mutual labels:  graphql
React Admin Low Code
react-admin (via ra-data-hasura-graphql provider) + hasura = :)
Stars: ✭ 161 (-3.59%)
Mutual labels:  graphql
Express Graphql Typescript Boilerplate
A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Graphql Rails Blog
Blog App built with Rails 5, React and GraphQL
Stars: ✭ 160 (-4.19%)
Mutual labels:  graphql
Graphql Landscape
🌄Landscape for the GraphQL ecosystem
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Repo Remover
A web app that helps you archive and delete old/unused repos, quickly and easily.
Stars: ✭ 160 (-4.19%)
Mutual labels:  graphql
Examples
Examples of Mock Service Worker usage with various frameworks and libraries.
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Graphql Spring Boot Starter
Spring boot starter for GraphQL
Stars: ✭ 166 (-0.6%)
Mutual labels:  graphql
Express Graphql Example
Example project how to use Express and GraphQL
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql
Parser
A lexer and parser for GraphQL in .NET
Stars: ✭ 163 (-2.4%)
Mutual labels:  graphql

wxapp-graphql

一个适用于小程序的 GraphQL 客户端,由 Authing 开发维护。

使用 NPM 安装

$ npm install wxapp-graphql --save

如何在小程序里使用 NPM,请参考这篇文章

使用

// 引入文件
var gql = require('wxapp-graphql');
var GraphQL = gql.GraphQL;

Page({
  test: function() {

    // 初始化对象
    let gql = GraphQL({
      url: 'https://users.authing.cn/graphql' // url 必填 
    }, true);
    
    // query 查询,mutation 请使用 gql.mutate
    gql.query({
        query: `query getAccessTokenByAppSecret($secret: String!, $clientId: String!){
    getAccessTokenByAppSecret(secret: $secret, clientId: $clientId)
}`,
        variables: {
          secret: '427e24d3b7e289ae9469ab6724dc7ff0',
          clientId: '5a9fa26cf8635a000185528c'
        }
    }).then(function(res) {
      //成功
      console.log(res);
    }).catch(function(error) {
      //失败
      console.log(error);
    });
    
  }
});

发起 mutation 请求

gql.mutate({
  mutation: 'YOUR_GQL',
  variables: 'YOUR_variables'
})

配置全局 header 和错误拦截

var gqlwx = require('../graphql/wxgql');
var GraphQL = gqlwx.GraphQL;

var gql = GraphQL({
    //设置全局 url
    url: 'https://users.authing.cn/graphql', // url 必填

    //设置全居动态 header
    header: function () {
        return {
            // something....
            'X-Test-Header': 'test header content'
        }
    },

    //设置全居错误拦截
    errorHandler: function (res) {
        //do something
    }
  }, true
);

module.exports = gql;

全局详细配置请查看 example.

Get Help

  1. Join us on Gitter: #authing-chat
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].