refactored app bootstrap

What do you think about this kind of index.php refactoring ?

Also I added an index_dev.php that can only be run in local env.

@guillermoandrae pls check boostrap phpunit to see if you're ok