migrating app.js to index.js

object oriented stuff