title: pool.query is not a function - Using npm mysql package to use connection pool
body: <p>I'm using <a href="https://github.com/mysqljs/mysql" rel="noreferrer">npm mysql package</a>, to create a connection pool to my <a href="/questions/tagged/mysql" class="post-tag" title="show questions tagged &#39;mysql&#39;" rel="tag">mysql</a> DataBase with <code>dbHandler.js</code> :</p>
  
  <pre><code>var mysql = require("mysql");
  
  var pool = mysql.createPool({
      connectionLimit : 10,
      host: "path.to.host",
      user: "username",
      password: "password",
      database: "dbname",
      debug: false
  });
  
  exports.pool = pool;
  </code></pre>
  
  <p>Then I call it inside <code>routesHandler.js</code>, to handle my SQL request :</p>
  
  <pre><code>var mysql = require("mysql");
  var pool = require("./dbHandler");
  
  exports.login = function(req, res) {
      var email = req.body.email;
      pool.query('SELECT * FROM users WHERE users.email = ?', [email], function(
          error,
          results,
          fields
      ) {
          if (error) {
              res.send({
                  code: 400,
                  failed: "Error ocurred"
              });
          } else {
              if (results.length &gt; 0) {
                  //Mail authorized
                  res.send({
                      code: 200,
                      success: "Sucessfull login"
                  });
              } else {
                  //Mail unauthorized
                  res.send({
                      code: 403,
                      failed: "Unauthorized mail"
                  });
              }
          }
      });
  };
  </code></pre>
  
  <p>I'm not sure it's the best way to do it, but I can't seem to found a proper example... :/ <br>
  I would gladly :) accept any suggestions or links about the way to handle the whole :</p>
  
  <ul>
  <li>Connections to database + </li>
  <li>SQL requests to database</li>
  </ul>
  
  <p>But I'm getting that basic error message but I can't figure out how to get rid of it :</p>
  
  <blockquote>
    <p>TypeError: pool.query is not a function</p>
  </blockquote>
  
  <p>Any pointers will be welcome!</p>