I just started diving into the microservices topic, so please excuse if this is a stupid question.
Let's say I have two microservices, one providing a REST api and one being an angular microservice for a nice frontend. The angular microservice is expected to communicate with the other microservice. I saw many examples implementing this and its basically not a big deal. I am well aware of that. However, in all these examples I saw something like this in the angular microservice:
this.http.get('http://....:8080....');
At first I was just happy to get it running. However, right now I am wondering whether such implementations do not tightly couple the services to each other. In the http URL, we see the host and the port is also fix. That might work well in some cases, but, if our microservice e.g. chooses a port dynamically, we already have a problem right? Then we can't define the port in the other microservice in such a way. The same holds for the host information. If the microservice might be running on different hosts, we cannot always just define the host statically.
Please correct me if I'm wrong. Is there any way we can abstract away from these details, i.e. the host or the port but is there another way to find this out dynamically? Or are there other good alternatives for the communication between microservices that don't imply this problem?
I saw examples of services using a service registry. By means of this, we can abstract away from this a bit - no? Is this the only possibility? I am not sure whether this is relevant here, but so far I'm using Spring Boot to implement my microservices.