`
sillycat
  • 浏览: 2577724 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

GraphQL 2019(1)Apollo Basic

 
阅读更多
GraphQL 2019(1)Apollo Basic

Client React
https://github.com/apollographql/react-apollo
https://apollographqlcn.github.io/react-docs-cn/
https://juejin.im/post/5cff441ef265da1b6836b32b

Spring Boot Based Server
https://blog.csdn.net/taiyangdao/article/details/75303181
https://www.jianshu.com/p/d6aeeddccaf3
https://juejin.im/post/5d61397bf265da03c92703a3
https://juejin.im/post/5c886063e51d454ffb104bfd
https://github.com/graphql-java-kickstart/graphql-spring-boot
https://github.com/graphql-java/graphql-java
https://www.graphql-java.com/tutorials/getting-started-with-spring-boot/
https://graphql.org/code/#java

Sample
https://github.com/spring-petclinic/spring-petclinic-graphql
https://github.com/graphql-java/awesome-graphql-java

Type System - Query Mutation
Interface & Union Types

GraphQL - Int, Float, String, Boolean, ID

Simple example before I dive into my big project sample
https://github.com/SimonPower/hello-graphql
https://juejin.im/post/5d4fa9b2e51d4561d54de941

Data Loader
https://www.jianshu.com/p/fbd1257116b0

Debug Tool is here
http://localhost:4000/graphql

Try to Query with my code
query {
    getEmployees {
        cursor
      prevCursor
      nextCursor
      totalRecordCount
      hasMoreRecords
      records {
          id
          gmtCreate
          gmtModified
          name
      }
    }
}

Check this Project
https://github.com/graphql-boilerplates/node-graphql-server

Mutation example
mutation {
  signup (email: "luohuazju@gmail.com", password: "12345678", name: "Hua") {
    token
    user {
      id
      email
      name
    }
  }
}

Put this in the header if we need to access login
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjazVodmF4YXd4bnJwMGIwMHhvMm9qN2k0IiwiaWF0IjoxNTc5MjQ3OTc4fQ.89_D85qTKILtDsIPOj_hwho4ZTdtCfhNztVDZqaIyas"
}

Hashmap in NodeJS
https://www.npmjs.com/package/hashmap
const HashMap = require('hashmap').HashMap;

const mockItems = new HashMap();
mockItems.set("1",
  {
    "id": "1", "gmtCreate": 1579242037, "gmtModified": 1579242037,
    "name": "double11",
    "rankID": "1",
    "ratio": 0.02,
    "minimumAmount": 8000.00
  });
mockItems.set("2", {
    "id": "2", "gmtCreate": 1579242038, "gmtModified": 1579242038,
    "name": "double12",
    "rankID": "2",
    "ratio": 0.01,
    "minimumAmount": 5000.00
  });

function loadAllAllowances() {
    return mockItems.values();
}

function getAllowanceByID(id) {
    return mockItems.get(id);
}

module.exports = {
    loadAllAllowances,
    getAllowanceByID
}


NodeJS Cache
https://github.com/node-cache/node-cache

All options for ApolloServer
https://www.apollographql.com/docs/apollo-server/api/apollo-server/#apolloserver

References:
GraphQL
http://taobaofed.org/blog/2015/11/26/graphql-basics-server-implementation/
http://taobaofed.org/blog/2016/03/10/graphql-in-depth/
https://zhuanlan.zhihu.com/p/28077095
http://imweb.io/topic/58499c299be501ba17b10a9e
https://github.com/chentsulin/awesome-graphql

https://www.jianshu.com/p/2ec22fc1219c

Apollo Server
https://www.jianshu.com/p/70d61aee696b
https://github.com/wenshaoyan/apollo-server-example/blob/master/example-express.js
https://juejin.im/post/5b03cdcd51882542c760eaef
https://juejin.im/post/5ca1d5076fb9a05e512356a3
分享到:
评论

相关推荐

    graphql-basic-example

    在这个"graphql-basic-example"中,我们还会学习如何定义GraphQL类型(如上面的`User`类型)、自定义解析器(resolvers)来处理查询和突变,以及如何在React或其他前端框架中集成Apollo Client。 标签"JavaScript...

    basic-apollo-auth-demo:我的GraphQL Summit 2020演讲的演示代码

    在本文中,我们将深入探讨基于JavaScript的Apollo和Express的身份验证技术,这主要源自"basic-apollo-auth-demo"项目,这是为GraphQL Summit 2020准备的演讲演示代码。这个项目提供了一个基础示例,展示了如何在...

    koa-apollo-server-example:示例的node.js GraphQL服务器主要演示了Koa + Apollo Server + Knex + Basic Authentication(JWT)的基本设置

    koa-apollo-server-example 一个示例GraphQL服务器,主要演示了使用Koa + Apollo服务器+ Knex +基本身份验证(JWT)进行的基本设置包含什么Babel和Nodemon设置模块化架构数据库配置基本身份验证和授权用法环境设置...

    Basic-GraphQL

    1. **GraphQL简介**:GraphQL设计的目标是解决RESTful API中过度或不足的问题,提供一个接口来请求精确需要的数据,而无需管理多个端点。 2. **GraphQL语法规则**: - **查询(Query)**:用于获取数据,由字段、...

    棱柱形阿波罗2.0

    Apollo Basic 2.0是Apollo Server的一个基础版本,适合小型项目或者学习使用。在这个项目中,我们看到通过运行`npm install`命令安装依赖,这包括Apollo Server以及其他必要的库。接着,`npm run deploy`用于部署...

    basic-graphql-nodejs

    disponibilizar dados locais: npx json服务器--watch data / dados.json 模式:定义oq pode ser feito 解析器:... apolionar recursos ao apollo,para ele possuir mais dados npm install apollo-datasource-rest

    JS_project:全栈开发人员的注意事项

    全端学习笔记CS 基础演算法资料结构设计模式Process and Thread前端React React Context React Apollo Styled-components React 相关的Webpack 设定React Apollo and GraphQL Demo Repo React Basic Concept ...

    基本图形

    在给定的压缩包文件名“basic-graphql-master”中,我们可以推测这个项目可能与GraphQL有关,GraphQL是一种用于API的查询语言,主要用于获取、更新和管理数据。然而,标题和描述提到的是“基本图形”,所以这里的...

Global site tag (gtag.js) - Google Analytics