create dbService.js and move code to it