package api import ( "github.com/gin-gonic/gin" "github.com/simpletodoapp/go-todo-app/internal/config" "github.com/simpletodoapp/go-todo-app/internal/database" "github.com/simpletodoapp/go-todo-app/internal/service" ) // SetupRouter initializes the API router and routes func SetupRouter(cfg *config.Config, db *database.Database) *gin.Engine { router := gin.Default() // Setup middleware SetupMiddleware(router) // Setup API documentation SetupDocs(router, cfg) // Create services todoService := service.NewTodoService(db.DB) // Register handlers healthHandler := NewHealthHandler(db) healthHandler.RegisterRoutes(router) todoHandler := NewTodoHandler(todoService) api := router.Group("/api") todoHandler.RegisterRoutes(api) return router }