cmd

package
v0.0.0-...-9a03492 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: MIT Imports: 6 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL