title: NodeJS / Express - Make Available MySQL Connection Object in Router File
body: <p>I have the following in my <code>app.js</code> file:  </p>
  
  <pre><code>var mysql = require('mysql');
  var connection = mysql.createConnection({
      host: 'localhost',
      port: 3306,
      user: 'user',
      password: 'password',
      database: 'mydatabase'
  });
  connection.connect();
  </code></pre>
  
  <p>In <code>routes/index.js</code>, I currently have only the boilerplate code: </p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  module.exports = router;
  </code></pre>
  
  <p>How do I make available the <code>connection</code> object from the <code>app.js</code> file in <code>routes/index.js</code>?</p>