Skip to content

Commit 92eac66

Browse files
authored
Merge pull request #658 from graph-gophers/update-federation-example
update federation example
2 parents b7dc4b1 + c8f6c44 commit 92eac66

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)