package http import ( "tmr-watch/http/routers" "github.com/gin-gonic/gin" ) type Server struct { *gin.Engine } type Option func(*Server) func NewServer(options ...Option) *Server { s := &Server{ Engine: gin.New(), } for _, option := range options { option(s) } return s } func SetRouteOption() Option { return func(s *Server) { routers.HTTPServerRoute()(s.Engine) } }