/ ├── cmd ├── pkg (or internal) │ ├── server │ │ ├── http │ │ │ ├── handlers.go │ │ │ ├── requests.go │ │ │ ├── responses.go │ │ │ ├── server.go │ ├── creating │ ├── fetching │ ├── incrementing │ ├── storage │ ├── errors │ ├── counter.go │ ├── user.go ├── … package http import … func NewServer( fetchService fetching.Service, createService creating.Service, incrementService incrementing.Service, ) (http.Handler, error) { r := gin.New() r.Use(gin.Logger(), gin.Recovery()) // Auth (JWT) handler initialization authMiddleware, _ := jwt.NewGinMiddleware(fetchService) r.POST("/users/register", createUserHandlerBuilder(createService)) r.POST("/users/login", authMiddleware.LoginHandler) auth := r.Group("") auth.Use(authMiddleware.MiddlewareFunc()) auth.GET("/users/:userID", getUserHandlerBuilder(fetchService)) auth.POST("/counters", createCounterHandlerBuilder(createService)) auth.GET("/counters/:counterID", getCounterHandlerBuilder(fetchService)) auth.POST("/counters/increment", incrementCounterHandlerBuilder(fetchService, incrementService)) return r, nil }