Encoding for bytewise extracted to helper

- modularize db.js to db/index.js
- config.js now takes in consideration of process.cwd() for default db
  location
- posts db/model now uses the new helper extracted version of
  encodeIntHex for bytewise encoding.