diff --git a/pkg/mining/service.go b/pkg/mining/service.go index 9b3685d..8d88b5d 100644 --- a/pkg/mining/service.go +++ b/pkg/mining/service.go @@ -489,9 +489,8 @@ func NewService(manager ManagerInterface, listenAddr string, displayAddr string, }, nil } -// InitRouter initializes the Gin router and sets up all routes without starting an HTTP server. -// Use this when embedding the mining service in another application (e.g., Wails). -// After calling InitRouter, you can use the Router field directly as an http.Handler. +// svc.InitRouter() +// http.Handle("/", svc.Router) // embed as handler in Wails or another HTTP server func (s *Service) InitRouter() { s.Router = gin.Default() @@ -622,9 +621,8 @@ func (s *Service) ServiceStartup(ctx context.Context) error { return fmt.Errorf("server failed to start listening on %s within timeout", s.Server.Addr) } -// SetupRoutes configures all API routes on the Gin router. -// This is called automatically by ServiceStartup, but can also be called -// manually after InitRouter for embedding in other applications. +// svc.InitRouter() +// svc.SetupRoutes() // re-call after adding middleware manually func (s *Service) SetupRoutes() { apiGroup := s.Router.Group(s.APIBasePath)