title: Why is my return variable value not being recognised in node module
body: <p>I have got a node file requesting a return variable from another module page.  All the data functions &quot;work&quot; but the &quot;return query&quot; is not sending the query value back to my initial request and my existingUser variable is undefined.  In the console logs checks I put in the existingUser ones displays before the query one.  It is like the await request is being ignored.</p>
  <p>Any help appreciated...and I'm a newbie to all this!</p>
  <p><strong>Request page</strong> -</p>
  <pre><code>const sqlRequests1 = require('./sqlAdmin/sqlRequests1');
  .
  .
  .
  app.post('/', async (req, res) =&gt; {
              const { club, first_name, last_name, email, tel, address, post_code, password, passwordConfirmation} = req.body;
            
              let existingUser = await new sqlRequests1.Queries('contact',email).getAll();
              
              console.log(`existingUser is ${existingUser}`);  //THIS CONSOLE LOG RETURNS &quot;undefined&quot;
              
              if (existingUser) {
                return res.send('Email in use');
              }
            
              if (password !== passwordConfirmation) {
                return res.send('Passwords must match');
              }
            
              res.send('Account created!!!');
            });
  </code></pre>
  <p><strong>Module page</strong> - sqlRequests1</p>
  <pre><code>class Queries {
      constructor(table, selection) {
          this.table = table; 
          this.selection = selection; 
          
          console.log(selection);  //THIS DATA CHECK WORKS
          
          if(!table) {
              throw new Error('Need a table to connect to');
          };
          
      };
      
  getAll() {
  //Confirm if the emasil exists - if it does then give error message     
      let q = 'SELECT * FROM ?? ';
      
          connection.query(q, this.table, function (error, results,fields) {
          if (error) throw error;
          const query = (results[0].email);
          console.log(`query is ${query}`);  //THIS PROVIDES THE CORRECT DATA
          return query;  //THIS RETURN IS NOT GETTING BACK TO existingUser variable?
          });
  };
  
  };      
      
  module.exports.Queries = Queries;
  </code></pre>