graphql cli 开发graphql api flow
作用
代码生成
schema 处理
脚手架应用创建
项目管理
安装cli
npm install -g graphql-cli
初始化项目(使用.graphqlconfig管理)
以下为demo
- demo 项目创建
graphql init

- 添加数据操作(一般名称为database)
使用prisma cli
prisma init database
- 添加database 项目
graphql add-project database

- 修改配置
.graphqlconfig.yaml
projects:
demo:
schemaPath: schema.graphql
extensions:
endpoints:
default: 'http://localhost:4466'
database:
schemaPath: src/generated/prisma.graphql
extensions:
prisma: database/prisma.yml
- 生成schema
graphql get-schema --project database

代码生成
- 生成typescript typings
.graphqlconfig.yaml
projects:
demo:
schemaPath: src/schema.graphql
extensions:
endpoints:
default: 'http://localhost:4466'
codegen:
generator: typegen
language: typescript
input: "{binding,prisma}/*.ts"
output:
typings: src/typings.ts
database:
schemaPath: src/generated/prisma.graphql
extensions:
prisma: database/prisma.yml graphql codegen- 生成type 定义
修改配置
projects:
demo:
schemaPath: src/schema.graphql
extensions:
endpoints:
default: 'http://localhost:4466'
codegen:
generator: prisma-binding
language: typescript
output:
binding: src/prisma.ts
database:
schemaPath: src/generated/prisma.graphql
extensions:
prisma: database/prisma.yml graphql codegen- binding
修改配置
install binding:
npm install -g graphql-binding projects:
demo:
schemaPath: src/schema.graphql
extensions:
endpoints:
default: 'http://localhost:4466'
codegen:
- generator: graphql-binding
language: typescript
input: schema.js
output:
binding: mybinding.ts
database:
schemaPath: src/generated/prisma.graphql
extensions:
prisma: database/prisma.yml graphql codegen
graphql cli 开发graphql api flow的更多相关文章
- 使用ASP.NET Core开发GraphQL服务器 -- 预备知识(上)
为了介绍使用ASP.NET Core构建GraphQL服务器,本文需要介绍一下GraphQL,其实看官网的文档就行. 什么是GraphQL? GraphQL 既是一种用于 API 的查询语言也是一个满 ...
- 【视频】使用ASP.NET Core开发GraphQL服务
GraphQL 既是一种用于 API 的查询语言也是一个满足你数据查询的运行时. GraphQL来自Facebook,它于2012年开始开发,2015年开源. GraphQL与编程语言无关,可以使用很 ...
- ASP.NET Core Web API 开发-RESTful API实现
ASP.NET Core Web API 开发-RESTful API实现 REST 介绍: 符合REST设计风格的Web API称为RESTful API. 具象状态传输(英文:Representa ...
- [GraphQL] Write a GraphQL Schema in JavaScript
Writing out a GraphQL Schema in the common GraphQL Language can work for simple GraphQL Schemas, but ...
- [GraphQL] Serve a GraphQL Schema as Middleware in Express
If we have a GraphQL Schema expressed in terms of JavaScript, then we have a convenient package avai ...
- [GraphQL] Create a GraphQL Schema
we’ll take a look at the GraphQL Language and write out our first GraphQL Schema. We’ll use the grap ...
- flask开发restful api系列(8)-再谈项目结构
上一章,我们讲到,怎么用蓝图建造一个好的项目,今天我们继续深入.上一章中,我们所有的接口都写在view.py中,如果几十个,还稍微好管理一点,假如上百个,上千个,怎么找?所有接口堆在一起就显得杂乱无章 ...
- flask开发restful api
flask开发restful api 如果有几个原因可以让你爱上flask这个极其灵活的库,我想蓝图绝对应该算上一个,部署蓝图以后,你会发现整个程序结构非常清晰,模块之间相互不影响.蓝图对restfu ...
- 使用Jax-rs 开发RESTfull API 入门
使用Jax-rs 开发RESTfull API 入门 本文使用 Jersey 2开发RESTfull API.Jersey 2 是 JAX-RS 接口的参考实现 使用到的工具 Eclipse Neon ...
随机推荐
- 图解Kerberos认证工作原理
本文是我在看了这篇英文说明之后的总结 https://technet.microsoft.com/zh-cn/library/cc961976.aspx 是总结,不是翻译,所以是我看后按自己的理解写的 ...
- Tcp/Ip:Telnet指令
作用: 1,客户端连接服务端,并对服务端操作: (此功能已逐渐废弃,代替他的远程桌面): 2,telnet ip地址 端口号 用来测试Ip地址下,端口号是否可以被访问
- c++语言中的遍历
原文地址:http://www.cnblogs.com/xylc/p/3653036.html 随着C++11标准的出现,C++标准添加了许多有用的特性,C++代码的写法也有比较多的变化. vecto ...
- 20145221 《Java程序设计》第七周学习总结
20145221 <Java程序设计>第七周学习总结 教材学习内容总结 第十二章部分 - Lambda 认识Lambda语法 Lambda去可以重复,符合DRY原则,而且Lambda表达式 ...
- 导入tensorflow:ImportError: libcublas.so.9.0: cannot open shared object file: No such file or director【转】
本文转载自:https://blog.csdn.net/ksws0292756/article/details/80034086 版权声明:本文为博主原创文章,转载请一定附上博主原文链接,并署名转自Z ...
- HDU 2896 病毒侵袭(AC自动机)题解
题意:给你n个模式串,再给你m个主串,问你每个主串中有多少模式串,并输出是哪些.注意一下,这里给的字符范围是可见字符0~127,所以要开130左右. 思路:用字典树开的时候储存编号,匹配完成后set记 ...
- HDU 1698 Just a Hook(线段树:区间更新)
http://acm.hdu.edu.cn/showproblem.php?pid=1698 题意:给出1~n的数,每个数初始为1,每次改变[a,b]的值,最后求1~n的值之和. 思路: 区间更新题目 ...
- Symmetric Tree,对称树
问题描述: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). ...
- Codeforces Round #401 (Div. 2) A,B,C,D,E
A. Shell Game time limit per test 0.5 seconds memory limit per test 256 megabytes input standard inp ...
- a href 属性
两种用法: 页面跳转时使用 url (部分浏览器会阻止新窗口弹出页面),其他情况一律遵循 ‘结构样式行为分离’ 1. url href="#" 文档顶部 ...