title: nodejs mysql query return value of select statement
body: <pre><code>module.exports.getTragos = function(req, res) {
      var connection = conectar();
      connection.connect();
  
      connection.query('SELECT * from tipoAlcohol', function(err, rows, fields) {
          if (!err)
              return JSON.stringify(rows));
          else
              return  'Error while performing Query.';
      });
  
      connection.end();
  }
  </code></pre>
  
  <p>I would like to make the <code>getTragos</code> function to return the rows of the query executed, but <code>return JSON.stringify(rows));</code> is not returning them. I tried to put <code>console.log(rows)</code> and the query is executed fine.</p>
  
  <p>This is the code that invokes <code>getTragos</code>:</p>
  
  <pre><code>module.exports.iniciar = function(app) {
      app.get('/bebidas/getTipoAlcohol', function (req, res) {
          res.send(modelo.getTragos());
      });
  }
  </code></pre>