0

I started to work in an existing Angular app that consumes a monolithic Web API writen with .NET CORE. This API has dozens of controllers(routes).

In one of the main screens, when one specific event occurs, I could notice dozens of requests are made to load information for this screen. Each request targets different controllers(customer, contract, configurations etc). Some requests are nested. Angular gets an ID then makes another request passing this ID. The performance is poor.

I was thinking that it's possible to retrieve most data within one unique request if a create a kind of a gateway for aggregation.

All articles I found on Internet about that is about microservices. I don't plan to use microservices in this project, neither I plan to scale it out. I just want to refactor it to make less requests. Example of article: https://docs.microsoft.com/en-us/azure/architecture/patterns/gateway-aggregation

I could create a controller in which is injected all services/repositories that retrieves data for that frontend screen, although the existing GET methods in the other controllers would't neeed to exist anymore.

I also could make HTTP calls to other controllers inside this new controller to aggregate data. In this case, the request is for localhost as we are talking about the same application/server.

Which approuch or technology I would use in this situation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.