MossChat_Backend/route/server.go
2024-06-16 02:08:50 +08:00

23 lines
394 B
Go

package route
import (
"MossChat/logger"
"github.com/gin-gonic/gin"
)
var WebSv *gin.Engine
func InitWebServer(bind string) *gin.Engine {
router := gin.Default()
go func() {
err := router.Run(bind)
if err != nil {
logger.Log.Println("无法绑定Web服务器! 原因:", err)
return
}
WebSv = router
logger.Log.Println("Web服务器运行在", bind)
}()
return router
}