Type-graphql: Adding Schema Stitching

Created on 22 Aug 2020  路  1Comment  路  Source: MichalLytek/type-graphql

schema stitching

I would like to add schema stitching feature for us the users of microservice architecture.
this feature is supported in apollo server graphql.

we need this feature as soon as possible

Question Solved

Most helpful comment

You can use all the apollo and standard GraphQL tooling with TypeGraphQL:

import { mergeSchemas, ApolloServer } from "apollo-server";
import { buildSchema } from "type-graphql";

async function main() {
  const firstSchema = await buildSchema({
    resolvers: [FirstResolver],
  });
  const secondSchema = await buildSchema({
    resolvers: [SecondResolver],
  });

  const schema = mergeSchemas({
    schemas: [firstSchema, secondSchema],
  });

  const server = new ApolloServer({ schema });

  await server.listen();
}

>All comments

You can use all the apollo and standard GraphQL tooling with TypeGraphQL:

import { mergeSchemas, ApolloServer } from "apollo-server";
import { buildSchema } from "type-graphql";

async function main() {
  const firstSchema = await buildSchema({
    resolvers: [FirstResolver],
  });
  const secondSchema = await buildSchema({
    resolvers: [SecondResolver],
  });

  const schema = mergeSchemas({
    schemas: [firstSchema, secondSchema],
  });

  const server = new ApolloServer({ schema });

  await server.listen();
}

Was this page helpful?
0 / 5 - 0 ratings