Proper routes

The routes are a bit of a mess in `app._coffee` right now, and I also spotted several bugs in their implementation (e.g. `handleURL` returns API data for new URLs but redirects to view UI for existing URLs), so I'm moving them into a proper separate file, cleaning up the code, and fixing those bugs.

Will document the changes and comment when ready for CR.