title: NodeJS servers requests
body: <p>I'm working with NodeJS and I'm still familiarizing with it.</p>
  
  <p>Given the structure of my system I have two NodeJS servers running in different machines.
  The user/browser sends a request to the first server, which returns to the browser a JSON file that is located in this first machine. </p>
  
  <p>This first server also updates this JSON file every 5-10 seconds sending a request to the second server, which returns another JSON file which data will overwrite the one in the JSON file in the first server, so the next user/browser request will be updated.
  This second server also has a NodeJS server running but it only dispatches the request coming from the first server. </p>
  
  <p>I have this structure since I don't want the user to know about the second server for security reasons (Anyone could see the redirection with any dev tools).</p>
  
  <p>This two events are executed asynchronously since the Browser petitions may be in different time from the event updating the JSON file.</p>
  
  <p>My question is: How can I update the JSON file in the first server? I wonder if there's a NodeJS library I can use for requesting the new JSON file to the second server. </p>
  
  <p>I make the Browser-FirstServer petition via AJAX and everything works properly, but AJAX only works on the client side, so I'm not really sure how to do this for the First-Second server request.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Something i'm xpecting for is the following:</p>
  
  <pre><code>setInterval(function(){ 
  // make request to server 2
  
  //receive JSON file
  
  // use 'fs' for overwriting the JSON from server 1
  
  }, 5000)
  </code></pre>