![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
GraphQL
文章平均质量分 64
OOOOOOh~
从妈妈让我开始上幼儿园起,我就走上了一条不归路。。。
展开
-
graphql demo
????这次是很长时间没有看graphql这一块了,可能下个项目就要用到,emm,回顾一下。。服务端Installnpm init --ynpm install apollo-server-express express graphql mongoose需要的安装目录如下├── graphql│ ├── resolver.js│ └── schema.js├── models│ └── product.js├── mode-modules├── app.js├── p原创 2021-04-01 09:48:04 · 321 阅读 · 0 评论 -
vueapollo & graphql
配置首先搭建好一个vue的项目接着npm install vue-apollo apollo-boost graphql然后建立一个 vueApollo.js 的文件(注意我这里的 vueApollo.js 和 main.js 同级)import VueApollo from 'vue-apollo'import ApolloClient from 'apollo-boost'import Vue from 'vue'Vue.use(VueApollo);const apolloCl原创 2021-04-01 09:44:47 · 187 阅读 · 0 评论 -
graphql-4
Installnpm init --ynpm install apollo-server-express express graphql mongoosenpm install安装完成后,完善目录结构如下????├── graphql│ ├── resolver.js│ └── schema.js├── models│ └── product.js├── mode-modules├── app.js├── package-lock.json└── package.js原创 2021-04-01 09:37:33 · 108 阅读 · 0 评论 -
graphql-3
认证和中间件控制具有权限的人去访问数据接口,需要借助于express的中间件来实现中间件的本质实际上是一个function,它在接口执行之前首先拦截请求,然后决定是往下走还是返回错误消息const express = require('express');const { buildSchema} = require('graphql');const { graphqlHTTP} = require('express-graphql');// 定义schema,查询和类型const原创 2021-04-01 09:03:41 · 139 阅读 · 0 评论 -
graphql-2
Mutations定义修改mutation其实和定义查询Query是类似的Queryconst schema = buildSchema(` type Account { // name: String age: Int gender: String department: String } type Query { hello: String account: Account // }`)Mutat原创 2021-04-01 09:01:28 · 108 阅读 · 0 评论 -
graphql-1
graphql 与 restfulrestful属性状态转移,本质就是用定义uri,通过api接口来获取资源。通用系统架构,不受语言限制restful一个接口只返回一个资源,graphql一次可以获取多个资源restful用不同的url来区分资源,graphql用类型区分资源express+graphql最基本的写法const express = require('express');const {buildSchema} = require('graphql');const {gra原创 2021-04-01 08:57:54 · 150 阅读 · 0 评论 -
GraphQL之前后端实践Demo
BeforeinstallStart安装完成之后,就应该设计一个demo了!所以,这个demo应该怎么设计呢❓下面就从最简单的开始吧~hello❓当我们查询一个hello的时候,需要返回一个world字符串...原创 2021-03-23 15:30:20 · 281 阅读 · 0 评论 -
study - GraphQL
SchemaSchema定义了字段的类型、数据的结构,描述了接口数据请求的规则Schema 使用一个简单的强类型模式语法,称为模式描述语言(Schema Definition Language, SDL)⬇️SDL(Schema Definition Language)GraphQL有其自己的语言来编写GraphQL模式:GraphQL模式定义语言(SDL)SDL使用简单直观,同时...原创 2021-03-23 15:29:17 · 85 阅读 · 0 评论 -
graphQL.md
graphql 与 restfulrestful属性状态转移,本质就是用定义uri,通过api接口来获取资源。通用系统架构,不受语言限制restful一个接口只返回一个资源,graphql一次可以获取多个资源restful用不同的url来区分资源,graphql用类型区分资源express+graphql...原创 2020-10-21 09:00:33 · 213 阅读 · 0 评论