package routers import ( configs "learnsteam/cslms-api/configs" "learnsteam/cslms-api/internal/database" "github.com/gin-contrib/cors" "github.com/gin-gonic/gin" ) var Router *gin.Engine func Init() { gin.SetMode(configs.MODE) Router = gin.Default() config := cors.DefaultConfig() config.AllowOrigins = []string{"http://127.0.0.1:3000", "http://localhost:3000", "http://localhost:3030", "https://cslms-api.codingschool.co.kr"} config.AllowMethods = []string{"GET", "POST", "PUT", "DELETE", "PATCH"} config.AllowHeaders = []string{"Origin", "Content-Length", "Content-Type"} Router.Use(cors.New(config)) maindb := database.GetDB() InitAuthRouter(maindb, Router) InitCenterRouter(maindb, Router) InitPaperRouter(maindb, Router) InitQuizPaperRouter(maindb, Router) InitQuizRouter(maindb, Router) InitTokenRouter(maindb, Router) InitUserQuizPaperRouter(maindb, Router) InitUserQuizRouter(maindb, Router) InitUserRouter(maindb, Router) InitSwaggerRouter(Router) }