Yay or nay? I have several related but separate services that are to be run in different processes. They execute a particular task unique to the service. Their call signature is similar, but the name of the service changes. For example.
Service 1:
:5000/Invoice/<id>
:5000/Customer/<id>
Service 2:
:5001/Invoice/<id>
:5001/Customer/<id>
Each of the calls has e.g. GET and POST methods associated with it. I'd like to refactor this to be:
:5000/Invoice/<id>/service1
:5000/Customer/<id>/service1
:5000/Invoice/<id>/service2
:5000/Customer/<id>/service2
These calls would then delegate to the services themselves. Notice there is only one port or address to call the entire service instead of a port for each service on its own. So I'm thinking that adding a layer that calls the relevant service locally would be the way to go.
Is this a good approach? Is it more intuitive? It does add a layer of calling things again, so it might introduce some delay to requests, but maybe the trade off is worth it. Are there other ways of doing it? I'm rather new to web development, so I don't know much about common practices. If it makes a difference, I'm using Python and Flask.
There is one service that is used more often and the others and is more critical. Perhaps the other requests could be routed through that service.