How to execute REST calls from back end
<p>I have the below API that when gets called, will return the Result as Shown:</p>

<pre><code>app.get('/getAirData', function (req, res) {
  requestApi('http://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&amp;zipCode=95131&amp;distance=25&amp;API_KEY=1035C2AC-CDB8-4540-97E4-0E8D82BA335A', function (error, response, body) {
    if (!error &amp;&amp; response.statusCode == 200) {
      console.log(body);
      res.json(body);
    }
  });
});
</code></pre>

<p>Result:</p>

<pre><code>[{"DateObserved":"2016-05-11 ","HourObserved":0,"LocalTimeZone":"PST","ReportingArea":"San Jose","StateCode":"CA","Latitude":37.33,"Longitude":-121.9,"ParameterName":"O3","AQI":25,"Category":{"Number":1,"Name":"Good"}},{"DateObserved":"2016-05-11 ","HourObserved":0,"LocalTimeZone":"PST","ReportingArea":"San Jose","StateCode":"CA","Latitude":37.33,"Longitude":-121.9,"ParameterName":"PM2.5","AQI":37,"Category":{"Number":1,"Name":"Good"}}]
</code></pre>

<p>This API is trigged at the frontend..
What I want is for an object to run this code every 30 mins or so and store the result in some variable..</p>

<p>The object that will need to call the function is below.</p>

<pre><code>function SenObj (id) {
  this.Template = id;
  this.Type = "AirFlow";
  this.Req_ID = "Jessi";

}
//object
var user1 = new SenObj('id');
</code></pre>

<p>How can the user1 get the log result from <a href="http://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&amp;zipCode=95131&amp;distance=25&amp;API_KEY=1035C2AC-CDB8-4540-97E4-0E8D82BA335A" rel="nofollow">http://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&amp;zipCode=95131&amp;distance=25&amp;API_KEY=1035C2AC-CDB8-4540-97E4-0E8D82BA335A</a>' at the back end itself..</p>

<p>REST calls works fine but how do user1 get the same output at the backend </p>

<p>Really appreciate some help on this.</p>

<p>Much thanks
Jessi</p>