I am trying to create multiple endpoints using Node Express API Gateway and it seems not working. What I would like to do is to have:
localhost:8080/api/v1/patients => localhost:8002/api/v1/patients
localhost:8080/api/v1/doctors => localhost:8003/api/v1/doctors
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.