Moving routing to route.js and handler to badgeController.js.
Refactoring fetching function to use promise to make it more readable and testable.