问题
According to Apollo docs
- "Apollo Server 2 exports all of graphql-tools, so makeExecutableSchema and other functions can be imported directly from Apollo Server."
- "Apollo Server is able to accept a schema that has been enabled by graphql-tools"
However, I've just noticed I can't directly import stitchSchemas from apollo-server (I've been using it from @graphql-tools/stitch), and am hours deep in problems that aren't making sense.
Does Apollo work with stitchSchemas or not?
回答1:
Yes, you can use stitchSchemas with Apollo Server, but you should install the latest version of graphql-tools and import stichSchemas from graphql-tools instead of apollo-server.
You can use the latest version of graphql-tools to build a GraphQLSchema object, whether through stitchSchemas, makeExecutableSchema or some other utility. You can then initialize ApolloServer using this schema:
const server = new ApolloServer({ schema })
来源:https://stackoverflow.com/questions/65565586/does-apollo-server-work-with-graphql-tools-stitchschemas