I'm the service url as
GET REQUEST http://myipaddress:5000/api/Tenant/tenants/{TenantID}
The TenantID
will be dynamic
I also have the POST as http://myipaddress:5000/api/Tenant/tenants
In this post request payload is passed in request body.
My gateway config yml file is as below
http:
port: 8080
admin:
port: 9876
hostname: localhost
apiEndpoints:
api:
host: localhost
paths: '/ip'
tenant-api:
host: localhost
paths: '/api/Tenant/tenants/*'
serviceEndpoints:
httpbin:
url: 'https://httpbin.org'
tenant-svc:
url: 'http://localhost:5000'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
default:
apiEndpoints:
- api
- tenant-api
policies:
# Uncomment `key-auth:` when instructed to in the Getting Started guide.
# - key-auth:
- proxy:
- action:
serviceEndpoint: httpbin
changeOrigin: true
- action:
serviceEndpoint: tenant-svc
changeOrigin: true
I get 404 when i try to perform the GET Request via proxy. Also can you let me know how can i add the POST api endpoints in my gatewayconfig.yml
The first issue is that you have multiple actions in proxy policy
remove the first action to make all calls go to tenant-svc
This configuration will accept all methods GET,POST whatever on '/api/Tenant/tenants/*' urls
to make Express-Gateway process /api/Tenant/tenants url you can modify api endpoint like:
https://www.express-gateway.io/docs/configuration/gateway.config.yml/apiEndpoints#markdown
I would assume no special handling of GET POST is required. In case you need Gateway to filter only specific methods you can add
to your api Endpoint configuration
So final config can look like
Or you can have multiple API Endpoints to the same pipeline with methods
Update: Multi service usage