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 ...
随机推荐
- Horizon代码的层次结构
Horizon中包含多个dashboard,每个dashboard又包含多个panel,每个panel有可以包含多个Tab.
- 使用U盘安装linux系统
1. 下载并安装:UltraISO.流氓软件太多,最后是在百度软件中心下的,推荐. 2. 插入U盘.打开UltraISO,然后:文件 -- 打开 -- 选择你的ISO文件,打开. 3. UltraIS ...
- Java集合转有类型的数组之toArray(T[] a)
在java变成中慎用强制类型转换,尽量使用类自带的转换函数或泛型.先看一行代码 错误方法: String[] array= (String[]) list.toArray(); 如果list中存放的是 ...
- Ubuntu安装配置rclone(Onedrive应用)
rclone安装 命令行安装 脚本安装 curl https://rclone.org/install.sh | sudo bash # 或者 curl https://rclone.org/inst ...
- nw.js node-webkit系列(17)怎样打包和分发你的应用
原文链接:http://blog.csdn.net/zeping891103/article/details/50790180
- linux第五周
第五周 给MenuOS增加time和time-asm命令 更新menu代码到最新版 在main函数中增加MenuConfig 增加对应的Time函数和TimeAsm函数 make rootfs 使用g ...
- 20145219《网络对抗》Web安全基础实践
20145219<网络对抗>Web安全基础实践 基础问题回答 SQL注入攻击原理,如何防御? 原理:SQL注入攻击指的是通过构建特殊的输入作为参数传入Web应用程序,而这些输入大都是SQL ...
- #ZLYD团队第二周项目总结
ZLYD团队第二周项目总结 项目进展 确定项目内容.目标.实现计划 首先确定游戏界面的游戏区域中墙的位置,绘制其图形,并通过其中的方法,返回墙壁的位置等属性. 根据豆子的位置,绘制其图形. 初始化吃豆 ...
- A*寻路算法详细解读
文章目录 A*算法描述 简化搜索区域 概述算法步骤 进一步解释 具体寻路过程 模拟需要更新F值的情况 Lua代码实现 在学习A*算法之前,很好奇的是A*为什么叫做A*.在知乎上找到一个回答,大致意思是 ...
- CONFLICT (modify delete)冲突修复
Demo git:(test) git merge feature CONFLICT (modify/delete): path/to/path/config.inc.php deleted in H ...