0

根据阿波罗文档

  • “Apollo Server 2 导出了所有的 graphql-tools,因此可以直接从 Apollo Server 导入 makeExecutableSchema 等功能。”
  • “Apollo 服务器能够接受由 graphql-tools 启用的模式”

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

Apollo 是否适用于stitchSchemas?

4

1 回答 1

1

是的,您可以stitchSchemas与 Apollo Server 一起使用,但您应该安装最新版本的并从graphql-tools导入而不是.stichSchemasgraphql-toolsapollo-server

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

const server = new ApolloServer({ schema })
于 2021-01-04T16:22:53.947 回答