Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

How would you adapt it for apollo router? #33

Open
dulguun0225 opened this issue Feb 9, 2023 · 2 comments
Open

How would you adapt it for apollo router? #33

dulguun0225 opened this issue Feb 9, 2023 · 2 comments

Comments

@dulguun0225
Copy link

dulguun0225 commented Feb 9, 2023

For example, makeSubscriptionSchema function takes in gatewaySchema: GraphQLSchema. How should I create gatewaySchema schema from supergraph.graphql?

Is there a much better way to handle subscription now?

@bradens
Copy link

bradens commented May 23, 2023

Wondering this myself, how should I configure this subscription code such that it can pull the types from my router instance?

@dulguun0225
Copy link
Author

@bradens this is roughly how I'm handling it:

import { makeExecutableSchema } from '@graphql-tools/schema';
const { makeSubscriptionSchema } = require('esm')(module)(
  'federation-subscription-tools'
);

const supergraph = fs.readFileSync(supergraphPath).toString();
const superGraphScheme = makeExecutableSchema({
  typeDefs: supergraph,
  resolvers: {}
});
const schema = makeSubscriptionSchema({
  gatewaySchema: superGraphScheme,
  typeDefs,
  resolvers
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants