Refactor route / api handling, introduce view controllers, router.js