23 lines
394 B
Go
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
|
|
}
|