How to use the route method and clean code