Refactor routes code for share view.