title: Using async and await to handle queries
body: <p>Having issues with using async and await. I'm executing two queries and then saving the result to a temp variable. After I have collected the response from all executed queries, I'm going to send that to the client.</p>
  <p>Here is my current example code.</p>
  <pre><code>module.exports = (app) =&gt; {
  
    app.get('/api/stats', (req, res) =&gt; {
      let fetch1 = '';
      let fetch2 = '';
  
      conn.query('query here', [], async (error, results) =&gt; {
        if (error) {
          return res.send({
            success: false,
            message: 'There was an error.'
          });
        } else {
           fetch1 = results;
        }
      });
  
      conn.query('query here', [], async (error, results) =&gt; {
        if (error) {
          return res.send({
            success: false,
            message: 'There was an error.'
          });
        } else {
          fetch2 = results;
        }
      });
  
  
      // I need to wait until the queries have resolved so that I can send the correct data
      return res.send({
        success: true,
        fetch1: fetch1,
        fetch2: fetch2
      });
    });
  };
  </code></pre>
  <p>I basically need to wait until the queries have been resolved so that I can send the correct data towards the end.</p>
  <p>Can anyone explain how I can use await and async to accomplish this?</p>
  <p>Thanks.</p>