title: How do I send requests in a for loop synchronously in nodejs?
body: <p>I'm trying to make facebook api requests in a <strong>for loop</strong> using <strong>request</strong> module in nodejs. But I need to make the loop and request calls <strong>synchronous</strong>. What am I doing wrong? </p>
  
  <pre><code>    async function sendRequestAsync(sender, messageData) {
          await request({
              url: "https://graph.facebook.com/v2.6/me/messages",
              qs: {access_token: PAGE_ACCESS_TOKEN},
              method: "POST",
              json: {
                  recipient: {id: sender},
                  message: messageData
              }
          });
       }
  
       function sendFoods (sender, results) {
           results.forEach(async result =&gt; {
               await request.sendRequestasync(sender, {text: result.cat});
               await request.sendRequestasync(sender, result.data);
               console.log(result);
           });
      }
  </code></pre>