package core import ( "fmt" "hongze/hongze_google_api/global" "hongze/hongze_google_api/init_serve" ) func RunServe() { //初始化路由 r := init_serve.InitRouter() //初始化验证器 if err := global.InitTrans("zh"); err != nil { fmt.Println("init trans failed, err:%v\n", err) return } fmt.Println("run server start") fmt.Println("run server:", global.CONFIG.Serve.Port) err := r.Run(fmt.Sprint("0.0.0.0:", global.CONFIG.Serve.Port)) // 监听并在 0.0.0.0:8080 上启动服务 if err != nil { panic(fmt.Errorf("服务启动失败,Err:%s", err)) } fmt.Println("run server end") }