Skip to content

Commit c8f6c44

Browse files
committed
update federation example
1 parent b7dc4b1 commit c8f6c44

File tree

3 files changed

+1239
-2224
lines changed

3 files changed

+1239
-2224
lines changed
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const { ApolloServer } = require('apollo-server')
2-
const { ApolloGateway, IntrospectAndCompose } = require('@apollo/gateway');
1+
import { ApolloServer } from '@apollo/server';
2+
import { startStandaloneServer } from '@apollo/server/standalone';
3+
import { ApolloGateway, IntrospectAndCompose } from '@apollo/gateway';
34

45
const gateway = new ApolloGateway({
56
supergraphSdl: new IntrospectAndCompose({
@@ -12,9 +13,12 @@ const gateway = new ApolloGateway({
1213

1314
const server = new ApolloServer({
1415
gateway,
15-
subscriptions: false,
16+
plugins: [
17+
ApolloServerPluginSubscription(),
18+
],
1619
});
1720

18-
server.listen().then(({ url }) => {
21+
(async () => {
22+
const { url } = await startStandaloneServer(server);
1923
console.log(`Server ready at ${url}`);
20-
});
24+
})();

0 commit comments

Comments
 (0)