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 ...
随机推荐
- Redis 资料整理
Redis is an open source, BSD licensed, advanced key-value store. Redis is often referred to as a dat ...
- HTTP从入门到入土(1)——五层网络模型
五层网络模型 简介 互联网的实现,依托于网络协议.网络协议又分为好几层,关于如何分层有过很多争论,比较受人认可的有五层模型.七层模型.四层模型.今天我们就来讲讲五层网络模型. 从名字就可以看出来,五层 ...
- iframe 跨域问题解决方案 利用window.name+iframe跨域获取数据详解
详解 前文提到用jsonp的方式来跨域获取数据,本文为大家介绍下如何利用window.name+iframe跨域获取数据. 首先我们要简单了解下window.name和iframe的相关知识.ifra ...
- Python笔记 #07# NumPy 文档地址 & Subsetting 2D Arrays
文档地址:np.array() 1.<class 'numpy.ndarray'> ndarray 表示 n 维度(n D)数组 (= n 行数组). 2.打印 array 结构 —— n ...
- windows 10占用cpu和内存过高
自从安装了windows 10,开机之后cpu和内存一直占用很高,尤其是system进程,一直占cpu在13%左右,上网查到一个解决方式,如下: cpu瞬间变为1%
- phpstorm 代码片段使用方法
原文链接: http://wwwquan.com/show-66-121-1.html 4.Live Templates代码片断 A)我们先介绍一个代码片段最基本的功能,我们要实现的目标是在html文 ...
- ImportError: cannot import name 'izip & TypeError: 'float' object cannot be interpreted as an integer
ImportError: cannot import name 'izip' 参考:https://codereview.stackexchange.com/questions/26271/impor ...
- SSH防止暴力破解--fail2ban
一.ssh密钥对无交互登录 实战1:通过密钥进行sshd服务认证 服务端:linl_S IP:10.0.0.15 客户端:lin_C IP:10.0.0.16 1)在客户端生成密钥对 ...
- DWZ 框架详解
这是一个智障的框架,能别用就别用.
- 【转】IntelliJ IDEA的光芒会盖过Eclipse吗
作为一个资深的Eclipse用户,我想对IntelliJ IDEA做一个更为严谨的审视.JetBrains的工作人员非常的友善,并为Podcastpedia.org和Codingpedia.org这两 ...