title: I need an example for a code in javascript
body: <p>I've just started learning javascript around a week ago with the help of Eloquent Javascript, and while it is a really good book, I could never learn and understand concepts just by reading, so I thought I'd start experimenting in nodejs, and following tutorials.I also intend to learn to use MySQL along the way, so I decided to combine them, and as most guides talk about mongoDB, I have to mostly figure MySQL out myself along with Js.</p>
  
  <p>Anyway, here's a part of my main.js:</p>
  
  <pre><code>apiRoutes.get('/users', function(req, res){
      var userlist = Userdb.listusers();
      //res.json(userlist); ??
      //res.json(userlist.results); ??
  });
  </code></pre>
  
  <p>And here's a part of my userdb.js which will interact with my mysql server.</p>
  
  <pre><code>var Userdb = {
      newuser: function(username,userpassword) {
          connection.query("INSERT INTO " + config.dbtable + " (name,passwd) VALUES (\'" + username + "\',\'" + userpassword + "\');");
      },
      listusers: function() {
          connection.query('SELECT * FROM testing;',function(err, results, fields){
              if (err) throw err;
              console.log(results);
              //return results? 
          });
      }
  }
  
  module.exports = Userdb;
  </code></pre>
  
  <p>And this is pretty much where I'm stuck, I need to access the results I get in my listusers method from my main.js, and I need an example, or something that looks like this, as I haven't found anything similar. Any help would be appreciated!</p>
  
  <p><em>Also please note that, I intend to learn the languages and syntaxes my way, so I would like to use as few node apis as possible, even if other solutions would be easier/simpler. However suggestions are still welcome!</em></p>