All Projects → pi-ka-qiu → graphql-demo

pi-ka-qiu / graphql-demo

Licence: other
graphql前端实践

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
HTML
75241 projects

Projects that are alternatives of or similar to graphql-demo

gatsby-starter-redux-saas
An Gatsby starter for Saas products. Uses redux and apollo and a graphql token auth backend.
Stars: ✭ 18 (-14.29%)
Mutual labels:  graphql-client
protoc-gen-twirpql
Generate A GraphQL Layer from A Twirp Server: https://twirpql.dev
Stars: ✭ 49 (+133.33%)
Mutual labels:  graphql-client
neo4j-graphql-java
Pure JVM translation for GraphQL queries and mutations to Neo4j's Cypher
Stars: ✭ 94 (+347.62%)
Mutual labels:  graphql-client
StarWars
Minimal GraphQL based Jetpack Compose, Wear Compose and SwiftUI Kotlin Multiplatform sample (using StarWars endpoint - https://graphql.org/swapi-graphql)
Stars: ✭ 165 (+685.71%)
Mutual labels:  graphql-client
character-overlay
Web App for adding an OBS overlay with character information such as name, picture, and health for your favorite role-playing game.
Stars: ✭ 17 (-19.05%)
Mutual labels:  graphql-client
python-graphql-client
Simple module for making requests to a graphQL server in python.
Stars: ✭ 65 (+209.52%)
Mutual labels:  graphql-client
Apollo Android
🤖  A strongly-typed, caching GraphQL client for the JVM, Android, and Kotlin multiplatform.
Stars: ✭ 2,949 (+13942.86%)
Mutual labels:  graphql-client
graphql-typed-client
Strongly typed GraphQL client for .NET
Stars: ✭ 16 (-23.81%)
Mutual labels:  graphql-client
showcase
A Full Stack Journey with Micro Services and Micro Front Ends. Using dapr, kubernetes, react module federation and web assembly,
Stars: ✭ 45 (+114.29%)
Mutual labels:  graphql-client
LiveGQL
Use GraphQL Subscriptions on iOS 👌
Stars: ✭ 84 (+300%)
Mutual labels:  graphql-client
flutter-graphql
A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package. Built after react apollo
Stars: ✭ 45 (+114.29%)
Mutual labels:  graphql-client
vue-gql
A small and fast GraphQL client for Vue.js
Stars: ✭ 32 (+52.38%)
Mutual labels:  graphql-client
kobby
Kobby is a codegen plugin of Kotlin DSL Client by GraphQL schema. The generated DSL supports execution of complex GraphQL queries, mutation and subscriptions in Kotlin with syntax similar to native GraphQL syntax.
Stars: ✭ 52 (+147.62%)
Mutual labels:  graphql-client
artemis
Ruby GraphQL client on Rails that actually makes you more productive
Stars: ✭ 149 (+609.52%)
Mutual labels:  graphql-client
py-graphql-client
Dead-simple GraphQL client with subscriptions over websockets
Stars: ✭ 36 (+71.43%)
Mutual labels:  graphql-client
DotNetGraphQL
A sample demonstrating how to create a GraphQL Backend in .NET and consume it from a .NET mobile app created using Xamarin
Stars: ✭ 78 (+271.43%)
Mutual labels:  graphql-client
nim-graphql
Nim implementation of GraphQL with sugar and steroids
Stars: ✭ 47 (+123.81%)
Mutual labels:  graphql-client
gql-query-builder
This is a GraphQL query builder.
Stars: ✭ 30 (+42.86%)
Mutual labels:  graphql-client
elm-graphql
GraphQL made easy in Elm!
Stars: ✭ 56 (+166.67%)
Mutual labels:  graphql-client
aws-mobile-appsync-sdk-android
Android SDK for AWS AppSync.
Stars: ✭ 101 (+380.95%)
Mutual labels:  graphql-client

graphql_demo

A Vue.js project

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

Graphql尝鲜

在只学习graphql client端知识的过程中,我们常常需要一个graphql ide来提示graphql语法,以及实现graphql的server端来进行练手。 graphql社区提供了graphiql让我们使用

graphiql (npm):一个交互式的运行于浏览器中的 GraphQL IDE.

但graphiql提供的live demo基本打不开,难道刚接触graphql就要自己实现graphql的server端? 好在github用graphql写了一套api,我们可以去这里,登陆后即可体验一把graphql。

关于graphql的基础知识可以去这里看看

graphql client端选择

graphql在前端实现有以下方案。

Relay (github) (npm):Facebook 的框架,用于构建与 GraphQL 后端交流的 React 应用。
Apollo Client (github):一个强大的 JavaScript GraphQL 客户端,设计用于与 React、React Native、Angular 2 或者原生 JavaScript 一同工作。
graphql-request:一个简单的弹性的 JavaScript GraphQL 客户端,可以运行于所有的 JavaScript 环境(浏览器,Node.js 和 React Native)—— 基本上是 fetch 的轻度封装。
Lokka:一个简单的 JavaScript GraphQL 客户端,可以运行于所有的 JavaScript 环境 —— 浏览器,Node.js 和 React Native。
nanogql:一个使用模板字符串的小型 GraphQL 客户端库。

从npm download数量上看Apollo Client是最多的,并且Apollo也有服务端 的解决方案,所以这里选择Apollo Client作为graphql的client端 apollo client对于web 框架都有具体的实现,但是我更希望能像axios那样去使用graphql,而不是每套web框架都要去学一下具体实现,那样会折腾死自己。

项目结构如下

.
├── index.html
├── package.json
├── package-lock.json
├── README.md
├── src
│   ├── App.vue
│   ├── graphql                            // 接口
│   │   ├── search.graphql
│   │   └── index.js                       // export所有接口
│   ├── main.js
│   └── utils
│       └── graphql.js                    // 对Apollo-client封装
└── webpack.config.js

run的时候有记得把token换成自己的,因为我的token有可能已经失效。

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].