Skip to content

How to return the schema in json for frontends to use with graphql codegen? #2951

Answered by UnAfraid
khuongtp asked this question in Q&A
Discussion options

You must be logged in to vote

You can use integration testing package as an example of how to achieve this.
https://github.com/99designs/gqlgen/tree/master/integration

Codegen configuration points to the graphql endpoint where it would perform introspection
https://github.com/99designs/gqlgen/blob/master/integration/codegen.ts

Here you can see the command that generates the code npm run gen
https://github.com/99designs/gqlgen/blob/master/integration/package.json#L8

The graphql code generator is scanning src/**/*.graphql for your queries, mutations and subscriptions

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by khuongtp
Comment options

You must be logged in to vote
2 replies
@khuongtp
Comment options

@WillSkelton
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants