title: Return rows with nodejs and node-mysql
body: <p>I'm discovering Nodejs and the node-mysql module. I have a small problem. Every tutorial that I find explain how to do a select on the database but they never return the rows, they always log them, which is absolutely useless for my case.</p>
  
  <p>I have a app.js file :</p>
  
  <pre><code>// Get continents
  app.get("/continents", function(request, result) {
      console.log("Continents : " + database.findAllContinents());
  });
  </code></pre>
  
  <p>And a mysql.js file :</p>
  
  <pre><code>exports.findAllContinents = function(connection) {
      var connection = getConnection();
      connection.query('select id, code, name from Continent', function (err, rows, fields) {
          if (err) {
              console.log("Error in findAllContinents : " + err)
          }
          return JSON.stringify(rows);
      });
      closeConnection(connection);
  };
  </code></pre>
  
  <p>How can I make the function return the rows to use them in the app.js file ? I don't really want to create connections in the app.js file I want the DAO layer to be separated.
  Do you have any idea ?</p>
  
  <p>Also, if someone has an idea of the pros/cons of using node-mysql instead of an ORM (sequelize, persistence.js...)</p>
  
  <p>Thanks</p>