Update db.js

Created singleton for access the db