title: I want to call an external API (weather API) inside a lambda function asynchronously
body: <p>I am trying to get weather forecast using external API of openweathermap.org, and want to use node.js so far i am able to get forecast of single city without using API KEY and trying to get forecast of multiple cities with help of API Key as i am not able to find the proper way to do it with api key</p>
  
  <p>So here is clear picture of what i am trying to do:</p>
  
  <pre><code>const http = require("http");
  
  module.exports.getWeather = async event =&gt; {
  
      const url = "http://api.openweathermap.org/data/2.5/weather?q=${process.env.cityName},${process.env.countryCode}&amp;APPID=${process.env.secretKey}";
  
      console.log(url);
  
      const req =await http.request(url, (res) =&gt; {
  
          let body = '';
          console.log('Status:', res.statusCode);
          console.log('Headers:', JSON.stringify(res.headers));
  
        res.on('data', (d) =&gt; {
          body += d;
        });
        res.on('end', () =&gt; {
          let data = JSON.parse(body);
          console.log('daily weather', data.daily);
        });
      });
      req.on('error',(e) =&gt; {
        console.error("erreur");
      });
      req.end();
  };
  </code></pre>