changes to app.js, controllers.js and api.php