graphqlapollo-servergraphql-tools

Does Apollo Server work with GraphQL Tools stitchSchemas?


According to Apollo docs

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?


Solution

  • Yes, you can use stitchSchemas with Apollo Server, but you should install the latest version of graphql-tools and import stitchSchemas 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 })