package v1 import ( "database/sql" "go-cook/api/repositories" "github.com/labstack/echo/v4" ) type Handler struct { userRepo repositories.UserRepository } func NewHandler(conn *sql.DB) *Handler { return &Handler{ userRepo: repositories.NewUserRepository(conn), } } func (h *Handler) Register(v1 *echo.Group) { demo := v1.Group("/demo") demo.GET("/hello", h.DemoHello) demo.GET("/hello/:who", h.HelloWho) demo.GET("/hello/body", h.HelloBody) users := v1.Group("/users") users.POST("/new", h.NewUser) }