I have a question about the most efficient way to create an effective communication layer between different servers and what sort of way I should approach this, I am quite new to networking so I'm just trying to wrap my head around which way to approach such a problem.
So let's say I have one main server which takes information from a REST API, depending on the information contained from a get request inside the JSON formatted request, I would want to forward this request to the right server.
So let's say I have the main server lets call it M. And 3 other servers executing pretty much the same thing but in servers of different locations, let's call them A, B, C. Now the response I got from the API in the main server contained a bunch of content and most importantly A, so I want to forward this to A to respectively execute code depending on the content from the request, I also want to send a response once it's finished executing back to the main server.
I proposed hosting an API on each server, so some programme in the main server would analyze the response from the main API, forward it to the respective server which is listening to its own API, use the data from that API on that server to execute code, send a response when it's finished to the main API and done.
But I don't think this is a very efficient way of doing this, as I said before I am sort of a newbie to this. I've never used node.js but could this be used to make this work "better"? Or is there another way which would make this easier? I am very interested in this topic and if there are any useful readings please send them my way, Cheers!