mongo db code is moved out to db.js
Moved all db schema checks into db module
moved api routes into separate module