title: Passing a mysql connection to expression routing middleware function as argument
body: <br>
  I am wondering if I can pass a connected database instance to an express middleware as an argument.<br>
  For example:
  <pre><code>// in app.js
  const mysql = require('mysql');
  const mysqlCon = mysql.createConnection({
    // some configurations...
  })
  mysqlCon.connect((err)=&gt; if(err) throw err);
  </code></pre>
  <p>then in a separate file...</p>
  <pre><code>// in a separate file called: login handler
  const loginHandler = (req, res, dbCon) =&gt; {
    // query database and stuff...
  } 
  module.exports = loginHanlder;
  </code></pre>
  <p>then back in app.js passes the established mysql connection into the middleware handler</p>
  <pre><code>// back in app.js
  // a route
  const loginHandler = require('./handlers/loginHanlder.js');
  app.get('/login', loginHanlder(req, res, mysqlCon));
  </code></pre>
  <p>Will this work? Or are there a conventionally better way of achieving this goal?</p>