package router import ( "memora-api/internal/handler" "memora-api/internal/middleware" "github.com/gin-gonic/gin" ) func New(wordHandler *handler.WordHandler, authHandler *handler.AuthHandler) *gin.Engine { r := gin.Default() r.Use(middleware.CORS()) api := r.Group("/api") { api.POST("/auth/register", authHandler.Register) api.POST("/auth/login", authHandler.Login) api.GET("/auth/me", authHandler.Me) protected := api.Group("") protected.Use(middleware.AuthRequired()) { protected.POST("/words", wordHandler.AddWord) protected.GET("/words", wordHandler.GetWords) protected.POST("/study/sessions", wordHandler.CreateStudySession) protected.POST("/study/answers", wordHandler.SubmitStudyAnswer) protected.GET("/review", wordHandler.GetReviewWords) protected.POST("/review", wordHandler.SubmitReview) protected.GET("/stats", wordHandler.GetStatistics) protected.GET("/audio", wordHandler.GetAudio) } } return r }