Apollo Server 是否可以与 GraphQL Tools stitchSchemas 一起使用?

Does Apollo Server work with GraphQL Tools stitchSchemas?

根据Apollo docs

但是,我刚刚注意到我无法直接从 apollo-server 导入 stitchSchemas(我一直在使用它来自 @graphql-tools/stitch),并且我在问题中深陷了几个小时没有意义。

Apollo 是否使用 stitchSchemas?

是的,您可以将 stitchSchemas 与 Apollo Server 一起使用,但您应该安装最新版本的 graphql-tools 并从 graphql-tools 而不是 [=15] 导入 stichSchemas =].

您可以使用最新版本的 graphql-tools 构建 GraphQLSchema 对象,无论是通过 stitchSchemasmakeExecutableSchema 还是其他一些实用程序。然后,您可以使用此模式初始化 ApolloServer:

const server = new ApolloServer({ schema })