Apollo Server是否可以与GraphQL Tools的schemaSchemas一起使用? [英] Does Apollo Server work with GraphQL Tools stitchSchemas?
问题描述
根据 Apollo文档
- " Apollo Server 2导出所有graphql-tools,因此makeExecutableSchema和其他功能可以直接导入来自Apollo Server."
- ""Apollo服务器能够接受已通过以下方式启用的模式:graphql-tools"
但是,我刚刚注意到我无法直接导入 stitchSchemas来自apollo-server(我一直在@ graphql-tools/stitch中使用它),并且在没有意义的问题上花了很长时间.
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.
Apollo是否可以使用stitchSchemas?
Does Apollo work with stitchSchemas or not?
推荐答案
是的,您可以在Apollo Server中使用 stitchSchemas
,但是您应该安装最新版本的 graphql-tools
并从 graphql-tools
而不是 apollo-server
导入 stichSchemas
.
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
.
您可以使用最新版本的 GraphQLSchema
对象,无论是否通过 stitchSchemas
, makeExecutableSchema 代码>或其他实用程序.然后,您可以使用以下架构初始化ApolloServer:
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 })
这篇关于Apollo Server是否可以与GraphQL Tools的schemaSchemas一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!