31 lines
814 B
Go
31 lines
814 B
Go
package routers
|
|
|
|
import (
|
|
"learnsteam/learsteam-quiz-api/internal/database"
|
|
|
|
"github.com/gin-contrib/cors"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
var Router *gin.Engine
|
|
|
|
func Init() {
|
|
gin.SetMode(gin.ReleaseMode)
|
|
Router = gin.Default()
|
|
config := cors.DefaultConfig()
|
|
config.AllowOrigins = []string{"http://127.0.0.1:3000", "http://localhost:3000", "http://localhost:3030", "https://learnsteam-quiz.jongyeob.com"}
|
|
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)
|
|
InitTokenRouter(maindb, Router)
|
|
InitUserRouter(maindb, Router)
|
|
InitProgramRouter(maindb, Router)
|
|
InitQuizRouter(maindb, Router)
|
|
|
|
InitSwaggerRouter(Router)
|
|
}
|