Home > Software engineering >  Is it possible to keep same api urls when moving from monolith to micro service on Azure
Is it possible to keep same api urls when moving from monolith to micro service on Azure

Time:11-14

I am breaking a monolith that is hosted as an app service on Azure. Application is made on .NET 4.8.

Is it possible to keep existing API calls in place, but redirect to a microservice instead of processing it by existing APP service?

Example: Call POST some-url.azurewebsites.com/api/some-endpoint should stay same, but getting processed by my-microservice.net/api/some-endpoint

CodePudding user response:

Check out the Azure API Management Service. This service allows you to use different API backends from a single frontend with capabilities to rewrite requests.

CodePudding user response:

UPDATE:

You can also use a reverse proxy to redirect the API calls. This is a cheaper (cloud cost) way compared with the APIM solution, but it does require some dev efforts.


One of the ways to achieve this is to leverage APIM in Azure, which acts as an API gateway and hides your microservices.

Assuming that you have designed two services,

  • microservice A
  • microservice B

Your existing API endpoints are,

  1. some-url.azurewebsites.com/api/endpoint-1
  2. some-url.azurewebsites.com/api/endpoint-2

You can now setup the existing APIs in the APIM as above, then create an API policy per endpoint to redirect calls to microservice A and microservice B,

  1. some-url.azurewebsites.com/api/endpoint-1 -> service-A.azurewebsites.com/api/endpoint-1
  2. some-url.azurewebsites.com/api/endpoint-2 -> service-B.azurewebsites.com/api/endpoint-2

Azure App Gateway can achieve the same result, but it could be expensive and hard to manage the redirects.

  • Related