标签:.com -- row data- 运行 serve depend save 初始化
类似的工具比较多,比如prisma 、qloo、golang 的gqlgen、apollo-codegen
graphql-code-generator 也是一个不错的工具(灵活、模版自定义。。。)
npm install --save-dev graphql-code-generator graphql
Or
yarn add -D graphql-code-generator graphql
yarn init -y
yarn add --dev graphql-code-generator graphql
package.json:
{
"name": "first",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"graphql": "^0.13.2",
"graphql-code-generator": "^0.10.7",
"graphql-codegen-typescript-template": "^0.10.7",
"typescript": "^3.0.1"
},
"scripts": {
"gen": "gql-gen --schema http://localhost:3009/graphql --template graphql-codegen-typescript-template --out ./typings/ \"./src/**/*.graphql\"",
"code":"tsc "
}
}
git clone https://github.com/rongfengliang/harborapi2graphql.git
yarn && yarn start
yarn gen
https://github.com/rongfengliang/graphql-code-generate-demo
https://github.com/dotansimha/graphql-code-generator
使用graphql-code-generator 生成graphql 代码
标签:.com -- row data- 运行 serve depend save 初始化
原文地址:https://www.cnblogs.com/rongfengliang/p/9496287.html