Moved the app initialization and routing to controllers.