首页 > 其他 > 详细

从graphql endpoint获取schema文件

时间:2019-09-13 09:39:46      阅读:118      评论:0      收藏:0      [点我收藏+]

graphql server端有更新,client端需要重新获取schema文件用于创建新的api request,下面简要记录如何从graphql endpoint获取schema文件

 You can simply install the CLI using npm or yarn by running the following command. This will add the graphql (and shorter gql) binary to your path.

    npm install -g graphql-cli

 Then, you can type [command] just like bellow to create  a  file named  .graphqlconfig

技术分享图片

 

 

 Now , you can get schema 

技术分享图片

 

 Ops! Now specific headers is needed. We open .graphqlconfig file to edit it.

技术分享图片

 

 Pay attention to edit this file, since it‘s very important to the result.

OK, now we can get the  damn schema.json by 

 graphql get-schema --output="schema.json"

技术分享图片

 

 Done. Now I can go to bed and have a good sleep.

Happy Mid-Autumn Festival !

 

从graphql endpoint获取schema文件

原文:https://www.cnblogs.com/fuyaozhishang/p/11515676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!