Fixed bug where db was not being properly passed around. Changed db exporting to use module.exports instead of express.get