1

I would like to add Relay Modern to my app started from react-starter-kit. relay-compiler needs a schema definition file (schema.graphql), how can I generate it?

elcsiga
  • 170
  • 1
  • 8

1 Answers1

3

You can use get-graphql-schema for that:

npm install -g get-graphql-schema
get-graphql-schema ENDPOINT_URL > schema.graphql

This is based on a GraphQL introspection query, here's more information.

marktani
  • 7,578
  • 6
  • 37
  • 60
  • Probably a strongly react-starter-kit related question, but as I see, I need a running server to export the schema this way. Is there any possibility to generate statically somehow? (... to build the whole isomorphic app in one step) – elcsiga May 19 '17 at 07:16
  • Could you try looking into https://github.com/graphcool/babel-plugin-react-relay maybe? It's been written for Relay Classic so you might need to adjust it. – marktani May 19 '17 at 22:26