refactoring app.js start process.