Ai
1 Star 0 Fork 8

windynet/gdshop-admin-go-api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 791 Bytes
一键复制 编辑 原始数据 按行查看 历史
公用 提交于 2021-09-08 17:50 +08:00 . [代码完善](dev-shop): 使用rpc提供服务
package main
import (
"fmt"
_ "gdshop-admin-go-api/boot"
_ "gdshop-admin-go-api/router"
"github.com/gogf/gcache-adapter/adapter"
"github.com/gogf/gf/frame/g"
)
func main() {
//s := g.Server()
//s.SetPort(8001)
// 平滑重启,win不支持,先屏蔽掉
//s.EnableAdmin()
s := g.Server()
adapterRedis := adapter.NewRedis(g.Redis())
g.DB().GetCache().SetAdapter(adapterRedis)
err := s.Start()
if err != nil {
panic(err)
}
staticServer := g.Server("static")
staticServer.SetIndexFolder(true)
staticServer.SetServerRoot(g.Cfg().GetString("upload.WwwrootPath"))
staticServer.SetPort(g.Cfg().GetInt("upload.StaticServerPort"))
err = staticServer.Start()
if err != nil {
panic(err)
}
fmt.Println("主服务, 路由个数:", len(s.GetRouterArray()))
g.Wait()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/windyzone/gdshop-admin-go-api.git
git@gitee.com:windyzone/gdshop-admin-go-api.git
windyzone
gdshop-admin-go-api
gdshop-admin-go-api
master

搜索帮助