0

When I was building my web application I deployed it as two project a Webapi server and a Frontend using Angular. Anyways, for SEO and other consideration I used nodejs server to Server Side Rendering My Angular Application.

And lets say that

So when calling api on http://example.com/api from browser every thing is fine but my concern is when calling the api on SSR from nodejs server I will be using additional unnecessary traffic when I could just call the same api on http://localhost:5000/api.

My Question is

  • in a situation like that and when I call an Endpoint which is located on the same machine using its public IP/DomainName Am I actually using additional traffic or the network is smart enough to fetch the data from the localhost?
  • And when I call An Endpoint which is located on the same private network using it's public IP is it smart enough to use the private IP on the local network and therefore save unnecessary internet traffic?
  • And if not? Are there Any Standard solutions/Patterns to solve this problem?
Diaa Eddin
  • 389
  • 3
  • 13
  • 1
    Why don't you add the domain name in the `hosts` file? – David Feb 10 '20 at 09:16
  • Good Idea.. it did not came to my mind. I just want to know what is the best practice especially when running a nodejs server for SSR when the api is begin served from the same machine.. but I could not find any resource addressing this problem. – Diaa Eddin Feb 10 '20 at 18:05

0 Answers0