title: Youtube search API results not displaying in the EJS file
body: <p>I am implementing YouTube Search API in my Website, when I am calling the api from my route the results are returned but the page is rendered while the results are being computed, I guess because of the asynchronous behavior.</p>
  
  <p>My route through which I am calling the API:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>router.get('/video/results/:search_query', middleware.ensureAuthenticated, function (req, res) {
      query = req.params.search_query;
      console.log(query);
      var dataFinal;
      var resp = youtube.search.list({
          part: 'snippet',
          q: query,
          type: 'video'
      },function (err, data, response) {
          if (err) {
              console.error('Error: ' + err);
              res.json({
                  status: "error"
              });
          }
          if (data) {
             // console.log(typeof data);
              dataFinal = data;
             //  return res.json({
             //      status: "ok",
             //      data: data
             //  });
  
              console.log(data);
              //res.render('resultsVideo',{results:data})
          }
      });
      res.render('resultsVideo',{data:dataFinal})
  
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>Please tell me how can I call the API and use the results in my EJS file to display.  </p>