Reputation: 21
Good work guys.
My project that I developed with Node JS is running at 8001 PORT
http://localhost:8001/companies_getAll (return data)
I will use EXPRESS-GATEWAY as I want to install a microservice build. However, although I make the settings below, the data is not returned to me.
http://localhost:8080/user (return "404 Not Found!")
http://localhost:8080/user/companies_getAll (return "Cannot GET /user/companies_getAll")
On the Node JS side, I have such an order.
const expressEndpoints = require('./endpoints/main')
expressApplication.use(expressEndpoints)
expressApplication.use((req, res) => {
res.status(200).send('404 Not Found!')
})
expressApplication.listen(8001, () => {
console.log('---------------------------------')
console.log('Running User Service, PORT: 8001')
console.log('---------------------------------')
})
and finally I have such a YAML file.
http:
port: 8080
admin:
port: 9876
host: localhost
apiEndpoints:
api:
host: localhost
paths: '/user'
serviceEndpoints:
user:
url: 'http://localhost:8001'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
- rewrite
pipelines:
default:
apiEndpoints:
- api
policies:
- proxy:
- action:
serviceEndpoint: user
changeOrigin: true
I can't get to "companies_getAll". Can you help me with this?
Upvotes: 0
Views: 376
Reputation: 2406
In the apiEndpoints section, the path uses an exact match; you’ll need to specify it just in full:
paths: '/users/companies_getAll'
Or use a wildcard:
paths: '/users/*'
Or have an array of paths
paths:
- '/user'
- '/user/companies_getAll'
Upvotes: 0