Commit 72778e91 by wang

go.mod

parent d4dcb6ed
Showing with 36 additions and 1 deletions
......@@ -9,7 +9,7 @@ cmd.exe~
/cmd/logs
/bat/logs/
/conf/prod/*.ini
/go.mod
go.mod
/logs
/mylogs
......
package main
import (
"flag"
"github.com/gin-gonic/gin"
"github.com/micro/go-micro/v2/web"
"golang_open_platform/boot"
"golang_open_platform/pkg/config"
"golang_open_platform/routes"
)
func main() {
var path string
flag.StringVar(&path, "config", "conf", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
panic(err)
}
gin.SetMode(config.Get("web.mode").String())
r := routes.InitRouter()
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
web.Name("go.micro.api.http.search"),
web.Handler(r),
web.Address(":"+port),
)
if err := service.Init(); err != nil {
panic(err)
}
if err := service.Run(); err != nil {
panic(err)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment