Node Express Gateway 多个 API 个端点

Node Express Gateway multiple API endpoints

我正在尝试使用 Node Express API 网关创建多个端点,但它似乎无法正常工作。我想做的是:

localhost:8080/api/v1/patients => localhost:8002/api/v1/patients

localhost:8080/api/v1/doctors => localhost:8003/api/v1/doctors

等..

http:
  port: 8080
apiEndpoints:
  patients:
    host: 'localhost'
    paths: '/api/v1/*'
  doctors:
    host: 'localhost'
    paths: '/api/v1/*'    
serviceEndpoints:
  patients:
    url: 'http://localhost:8003'
  doctors:
    url: 'http://localhost:8002'    
policies:
  - basic-auth
  - cors
  - expression
  - key-auth
  - log
  - oauth2
  - proxy
  - rate-limit
pipelines:
  patients:
    apiEndpoints:
      - patients
    policies:
    # Uncomment `key-auth:` when instructed to in the Getting Started guide.
    # - key-auth:
      - proxy:
          - action:
              serviceEndpoint: patients
              changeOrigin: true
  doctors:
    apiEndpoints:
      - doctors
    policies:
    # Uncomment `key-auth:` when instructed to in the Getting Started guide.
    # - key-auth:
      - proxy:
          - action:
              serviceEndpoint: doctors
              changeOrigin: true              

我们不应该使用通配符,设置完整路径是可行的。

...
  patients:
    host: localhost
    paths: '/api/v1/patients'
  doctors:
    host: localhost
    paths: '/api/v1/doctors'
...