-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgateway.js
More file actions
37 lines (31 loc) 路 1.34 KB
/
Copy pathgateway.js
File metadata and controls
37 lines (31 loc) 路 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const { ApolloServer } = require("apollo-server");
const { ApolloGateway } = require("@apollo/gateway");
const gateway = new ApolloGateway({
// This entire `serviceList` is optional when running in managed federation
// mode, using Apollo Graph Manager as the source of truth. In production,
// using a single source of truth to compose a schema is recommended and
// prevents composition failures at runtime using schema validation using
// real usage-based metrics.
serviceList: [
{ name: "car-content", url: "http://localhost:4001/graphql" },
{ name: "truck-content", url: "http://localhost:4002/graphql" },
{ name: "product-details", url: "http://localhost:4003/graphql" }
],
// Experimental: Enabling this enables the query plan view in Playground.
__exposeQueryPlanExperimental: false,
debug: true
});
(async () => {
const server = new ApolloServer({
gateway,
// Apollo Graph Manager (previously known as Apollo Engine)
// When enabled and an `ENGINE_API_KEY` is set in the environment,
// provides metrics, schema management and trace reporting.
engine: false,
// Subscriptions are unsupported but planned for a future Gateway version.
subscriptions: false,
});
server.listen().then(({ url }) => {
console.log(`馃殌 Server ready at ${url}`);
});
})();