app.js: route priority fixes

That idiot @nickstenning broke the route priority while refactoring. If
only we'd had some functional tests to show the breakage.

Anyway. Hopefully this fixes the issue.