This commit is contained in:
2026-09-10 13:49:36 -05:00
parent 7a5894d9cb
commit 768f44f669
8 changed files with 13805 additions and 14 deletions
+6 -4
View File
@@ -2,14 +2,16 @@ package routes
import (
"github.com/gofiber/fiber/v2"
"gorm.io/gorm"
"github.com/nprasad2077/NBA_Go/controllers"
"github.com/nprasad2077/NBA_Go/utils/middleware"
"gorm.io/gorm"
)
func RegisterPlayerAdvancedRoutes(app *fiber.App, db *gorm.DB) {
api := app.Group("/api/playeradvancedstats")
// api.Get("/fetch", controllers.FetchPlayerAdvancedStats(db))
api.Get("/scrape", controllers.ScrapePlayerAdvancedStats(db))
api.Get("/", controllers.GetAllAdvancedPlayerStats(db))
// Scraper trigger - never cached
api.Get("/scrape", middleware.EdgeCache(middleware.NoCache), controllers.ScrapePlayerAdvancedStats(db))
// Public query endpoint - edge cached with stale-while-revalidate
api.Get("/", middleware.EdgeCache(middleware.SemiDynamic, "nba-player-advanced"), controllers.GetAllAdvancedPlayerStats(db))
}