Moved database connection to main index.js

This resolves issues in which multiple connections need
to be made using createConnection. Unfortunately, createConnection
results in hanging queries which prevents pages from loading.
Since connection is made in main file, it doesn't have to be
made anywhere else. Making code much cleaner.