将多个后端服务组合到一个云端点API中

时间:2018-12-18 18:50:23

标签: google-cloud-endpoints

是否可以将GKE中运行的多个应用程序合并到同一Google Cloud Endpoints服务中?例如,假设我有一个Flask应用程序和一个Nodejs应用程序,它们均提供不同的api资源,可以将这两个后端服务组合到同一个云终结点API中。谢谢!

1 个答案:

答案 0 :(得分:0)

好像有办法!

只要将x-google-backend:部署为实际网关而不是Kubernetes侧卡,就可以将其添加到任何端点。

示例:

# Specify a backend to handle all routes, paths will be appended to the base path
x-google-backend:
  address: https://backend-hash-uc.a.run.app
paths:
  /hello:
    get:
      summary: Greet a user
      operationId: hello
  /goodbye:
    get:
      summary: Bid a user goodbye
      operationId: goodbye
      # Per operation overrides
      # Path is overwritten and path parameters are specified as query params
      x-google-backend:
        address: https://backend2-hash-uc.a.run.app/goodbye

来源:https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/google-cloud-endpoints/DehPzXAOzxI/Q3ABVK6zCQAJ