refactored out db access and config from server.js in part2