package router import ( "github.com/labstack/echo-jwt/v4" ) func registerAnalyticsRoutes(cfg *Config) { e := cfg.Echo // JWT middleware for protected routes jwtMiddleware := echojwt.WithConfig(echojwt.Config{ SigningKey: []byte(cfg.Cfg.JWTSecret), ContextKey: "user", }) protected := e.Group("/api", jwtMiddleware) // Analytics routes analytics := protected.Group("/analytics") analytics.GET("/reading-stats", cfg.AnalyticsHandler.GetReadingStats) analytics.GET("/device-usage", cfg.AnalyticsHandler.GetDeviceUsage) analytics.GET("/popular-books", cfg.AnalyticsHandler.GetPopularBooks) }