Apollo Server 是否与 GraphQL Tools 缝合架构一起使用? [英] Does Apollo Server work with GraphQL Tools stitchSchemas?

查看:26
本文介绍了Apollo Server 是否与 GraphQL Tools 缝合架构一起使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据阿波罗文档

  • "Apollo Server 2 导出所有的 graphql-tools,所以makeExecutableSchema 等函数可以直接导入来自 Apollo Server.
  • "Apollo Server 能够接受由graphql-工具

但是,我刚刚注意到我不能直接导入 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-toolscode> 并从 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.

您可以使用最新版本的graphql-tools来构建一个GraphQLSchema对象,无论是通过stitchSchemasmakeExecutableSchema 或其他一些实用程序.然后,您可以使用此模式初始化 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 缝合架构一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆