Move app module creation from main.js to app.js

Don't merge ! 

This does not work in `?debug` mode: `main.js` is loaded before `app.js`: the module is used before created
It's also ok to have a global variable for the application module.