Routing in separate "package router"


I’m new to Golang.
For several weeks I played with the Echo framework and faced the problem that I just can’t figure out how to use routing anywhere other than the entry point (server.go or main.go) and the root function main.
Tell me, is there a way to use routing somewhere else? For example, in a separate package “router”.
Using all the routing in the main file seems a bit awkward and dirty. I would like to change that.
I would be grateful for the help!


See if this works for you. Here is the directory structure of the code.
$$$ ls ./githubquestion
|—router/router.go (
|—main.go (

All routing logic is in different package.
Initializing the echo context from main and passing the context to the function responsible for handling the routing logic.


Keep sharing your valuable content.