Files
CoreApp/router/router.go

28 lines
726 B
Go

package router
import (
"coreapp/router/minecraft"
"github.com/gin-contrib/cors"
"github.com/gin-gonic/gin"
)
func Route(server *gin.Engine) {
server.Use(cors.New(cors.Config{
AllowAllOrigins: true,
AllowCredentials: true,
AllowMethods: []string{"*"},
ExposeHeaders: []string{"*"},
AllowHeaders: []string{"*"},
}))
rootGroup := server.Group("/")
minecraftGroup := rootGroup.Group("/minecraft")
{
servers := minecraftGroup.Group("/servers")
servers.Use(minecraft.ServerMiddleware())
servers.GET("/list", minecraft.ServerList)
servers.POST("/register", minecraft.ServerRegister)
servers.POST("/unregister", minecraft.ServerUnregister)
servers.GET("/ws", minecraft.ServerMessage)
}
}