I’m new to both GraphQL and Apollo Server and I’ve been trying to go through the Federation Quickstart.
It says that from the gateway project I should run:
rover subgraph publish YOUR_GRAPH_REF \ --routing-url https://flyby-locations-sub.herokuapp.com/ \ --schema ./locations.graphql \ --name locations
It also provides the contents of locations.graphql to copy and paste directly into the gateway project but explains this is just for convenience, because the .graphql file for each subgraph should be part of that graph’s codebase.
Now, what does this look like in a real case scenario? If each subgraph is a different SCM repo, checked out into a different local directory, then the value for the
--schema option must be the relative path to that directory in my filesystem, assuming I’ve cloned it and checked out the correct branch.
However, in all the examples I’ve seen so far (on how to get started creating a simple Node+TS+GraphQL project) they explain how to create and run the Apollo Server, but not where the .graphql comes from. So for the two subgraphs I’ve created I don’t have a .graphql file. How do I generate it?
Also, the Quickstart explains that using Rover for local composition I can instead point to the URL’s of the Apollo Server subgraphs (instead of a local .graphql file) but that this is not the recommended approach. That using “Compositon with Apollo Studio” is recommended instead because it reduces downtime for the whole graph. So it seems that to do it the right way, I need the .graphql files locally.
Can someone please fill in the gaps for me? or point me to any good article/post or video where this is better explained?