Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: "demo-api", Short: "demo-api 后端API", Long: "demo-api 后端API", RunE: func(cmd *cobra.Command, args []string) error { return nil }, }
View Source
var StartCmd = &cobra.Command{ Use: "start", Short: "启动 demo 后端API", Long: "启动 demo 后端API", RunE: func(cmd *cobra.Command, args []string) error { if err := conf.LoadConfigFromToml(confFile); err != nil { panic(err) } apps.IocServiceInit() api := http.NewHostHttpHandler() api.GetIocConfig() g := gin.Default() api.Registry(g) return g.Run(conf.C().App.HttpAddr()) }, }
程序的逻辑组装 1. 读取配置, 初始化全局变量 2. 初始化全局日志配置, 加载全局日志实例 3. 初始化底层服务, 将我们的服务实例注册到IOC中 4. 创建服务, 监听中断信号 5. 启动服务
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.