I am trying to figure out the best way to pass a mysql connection (using node-mysql) between my routes for express.js. I am dynamically adding each route (using a for each f
your solution will work if use db() instead of new db(), which returns an object and not the db connection
var db = require('../dbConnection.js'); //var connection = new db(); var connection = db();