How to set up a Federated Apollo microservice with TypeDefs and/or resolvers split into different directories/files?
it’s pretty simple actually, since typedefs require strings, you can simply split them as separate js files and concatenate strings.
Hey @rabbit6147 ! We have a few subgraph templates available that might help, depending on your language of choice.
-
TypeScript subgraph template: Under
src/graphql
, each domain has its typeDefs and resolvers in one file. -
JavaScript subgraph template: The schema is all under one file but the resolvers are split up into different files under
src/resolvers
You can also use the rover template list
CLI command (see instructions in the Apollo docs) to see all the available templates. Hope that helps get you started!