Refactor router.coffee into more generic routing.coffee