Get schema files from graphql endpoint

graphql server-side updates, client-side need to get schema file used to create new api request, how to get the following summary record schema files from graphql endpoint

 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 !

 

Guess you like

Origin www.cnblogs.com/fuyaozhishang/p/11515676.html
Recommended