title: how to make multiple api calls node.js promises
body: <p>I'm new to promises and async programming in javascript, and I'm trying to make multiple API calls to google maps places API in node.js then send data to the client once all the data is received. However, I'm getting some kind of a syntax error saying missing ) after argument list. Sorry if I'm asking a stupid question, I just can't seem to figure the issue out. Thanks for the help! </p>
  
  <pre><code>const fetch = require('node-fetch');
  
  module.exports = (app) =&gt; {
  
      app.post('/search-champ', (req, res) =&gt; {
  
  
          console.log(req);
          let lat = req.body.param.lat; //before: req.query.lat it's wrong
  
          let long = req.body.param.long;
          console.log(lat);
  
          const apiId = 'AIzaSyAeEPop5mofzDJhytOEMtxXaGWFqGB4Q3M';
          const urls = [
  
              'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=' + lat + ',' + long + '&amp;rankby=distance&amp;type=department_store&amp;key=AIzaSyAeEPop5mofzDJhytOEMtxXaGWFqGB4Q3M',
  
              'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=' + lat + ',' + long + '&amp;rankby=distance&amp;type=food&amp;key=AIzaSyAeEPop5mofzDJhytOEMtxXaGWFqGB4Q3M'
          ];
  
  
          Promise.all(urls.map(url =&gt;
  
  
              fetch(url)
              .then(checkStatus)
  
  
              .then(data =&gt; {
  
                  console.log(data)
                  res.send({
                      data
  
                  });
              })
  
          }).catch(err =&gt; {
              res.redirect('/error');
          });
  
          function checkStatus(response) {
              if (response.ok) {
                  return Promise.resolve(response);
              } else {
                  return Promise.reject(new Error(response.statusText));
              }
          }
  
  
  
  
      })
  }
  </code></pre>