We can pass our routes inside functions and pass them as a parameter to the NewAPIServer function. Its second parameter should receive a function that will instantiate as many routes as we want. See the example below.
In the example above, we pass all our routes already inside the NewAPIServer, we will have both the / and /cats routes.
Creating Sets of Route Managers
We can also create Route Managers to add sets of routes. See the example below:
This way, we will have the same two routes, but our func main() is less cluttered, and we can manage sets of routes more organized and controlled, allowing us to use our middlewares while maintaining a good code architecture.