在为 Apollo Federation 的网关编写超图时,您将创建一个.yaml
配置文件,其中包含到子图的路由 url。例如:https ://github.com/apollographql/supergraph-demo/blob/main/subgraphs/inventory/inventory.js
//supergraph.yaml
subgraphs:
inventory:
routing_url: http://inventory:4000/graphql
schema:
file: ./subgraphs/inventory/inventory.graphql
products:
routing_url: http://products:4000/graphql
schema:
file: ./subgraphs/products/products.graphql
users:
routing_url: http://users:4000/graphql
schema:
file: ./subgraphs/users/users.graphql
在上面的示例中,他们为每个子图启动 Apollo 服务器并组成一个超图。是否可以在不启动 Apollo 服务器且仅包含本地模式的情况下编写超图?