hyperioxx / frontman

Frontman is an open-source API gateway written in Go that allows you to manage your microservices and expose them as a single API endpoint. It acts as a reverse proxy and handles requests from clients, routing them to the appropriate backend service.
https://frontman-labs.github.io/frontman/
GNU General Public License v3.0
5 stars 0 forks source link

move buildRoutes function call from gateway handler #80

Closed amityahav closed 1 year ago

amityahav commented 1 year ago

this should be moved away and not be triggered each time a request is processed for better performance and because this prefix tree doesn't change unless there has been a modification in the service registry.

amityahav commented 1 year ago

@hyperioxx faced some annoying issue with this one. My idea was to move this function to be called once the service starts and each time a modification is made to the registry. Hence I would need a ref of the tree both in registry struct and gateway struct. So now the problem is that I get cyclic imports because in the service package I import gateway package because of the routing trie, which has backendService in its members so service package is imported but service package has gateway .. cycle . this is the branch I would love your opinion on this

hyperioxx commented 1 year ago

@amityahav If that's the case maybe we restructure and try and better align the modules