[英]Node Express Gateway multiple API endpoints
I am trying to create multiple endpoints using Node Express API Gateway and it seems not working. 我正在尝试使用Node Express API网关创建多个端点,但似乎无法正常工作。 What I would like to do is to have: 我想做的是:
localhost:8080/api/v1/patients => localhost:8002/api/v1/patients 本地主机:8080 / api / v1 /患者=>本地主机:8002 / api / v1 /患者
localhost:8080/api/v1/doctors => localhost:8003/api/v1/doctors 本地主机:8080 / api / v1 /医生=>本地主机:8003 / api / v1 /医生
etc.. 等等..
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
We should not do wildcard, setting the full path works. 我们不应该使用通配符,而是设置完整路径。
...
patients:
host: localhost
paths: '/api/v1/patients'
doctors:
host: localhost
paths: '/api/v1/doctors'
...
I think you can continue after seeing examples in the following link 我认为您可以在以下链接中看到示例后继续
https://www.express-gateway.io/docs/configuration/gateway.config.yml/apiEndpoints/ https://www.express-gateway.io/docs/configuration/gateway.config.yml/apiEndpoints/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.