BackendStack21 / fast-gateway

Fast-gateway is an easy to use Node.js API gateway framework built to handle large scale API traffic with great performance and scalability. Written with JavaScript, it is a framework for the masses!
MIT License
311 stars 35 forks source link

[NEED HELP] Routing doesn't work as expected #84

Closed itajenglish closed 2 years ago

itajenglish commented 2 years ago

Hi, @jkyberneees Thank you for making this package. I'm on a pretty hard deadline and have been unable to get the gateway to work the way I want.

As an example, I have my microservice called service-catalog with two routes attached to it, and they are prefixed with the API version as are all the other services /v1/services and /v1/service-categories When I add this route to the API gateway the request gets forwarded to the server as / which returns a 404. How do I get all routes in the gateway to forward the request as is?

const routes = [
  {
    prefix: '/v1/services',
    target: findServiceUrl('service-catalog-service'),
  },
  {
    prefix: '/v1/service-categories',
    target: findServiceUrl('service-catalog-service'),
  },
];
iapain commented 2 years ago

@itajenglish Please follow the documentation. You may use prefixRewrite or urlRewrite to properly route your urls.

itajenglish commented 2 years ago

I was able to get it working! Thank you.