backend functioning. Player models init

This commit is contained in:
Ravi Prasad
2025-04-30 21:19:31 -05:00
parent bde752041f
commit e269bc5145
10 changed files with 278 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
package main
import (
"log"
"github.com/gofiber/fiber/v2"
"github.com/nprasad2077/NBA_Go/config"
"github.com/nprasad2077/NBA_Go/routes"
"github.com/nprasad2077/NBA_Go/services"
)
func main() {
app := fiber.New()
db := config.InitDB()
// Automatically fetch player stats on startup
go func() {
if err := services.FetchAndStorePlayerStats(db, 2025); err != nil {
log.Println("Initial fetch failed:", err)
} else {
log.Println("Initial player stats fetch successful.")
}
}()
routes.RegisterPlayerRoutes(app, db)
app.Listen(":3001")
}