You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
680 B
27 lines
680 B
|
3 years ago
|
package app
|
||
|
|
|
||
|
|
import (
|
||
|
|
"fmt"
|
||
|
|
"appPlatform/initialization/initviper"
|
||
|
|
"appPlatform/initialization/route"
|
||
|
|
"appPlatform/overall"
|
||
|
|
)
|
||
|
|
|
||
|
|
type server interface {
|
||
|
|
ListenAndServe() error
|
||
|
|
}
|
||
|
|
|
||
|
|
// 启动服务
|
||
|
|
func RunItem() {
|
||
|
|
//加载基础配置
|
||
|
|
// var appConfig configApp.Server
|
||
|
|
initviper.RunViper(&overall.CONSTANT_CONFIG)
|
||
|
|
// fmt.Printf("CONSTANT_CONFIG----------->%v", overall.CONSTANT_CONFIG)
|
||
|
|
routers := route.InitialRouter()
|
||
|
|
portStr := fmt.Sprintf(":%d", overall.CONSTANT_CONFIG.Appsetup.Port)
|
||
|
|
startUp := InitServer(portStr, routers)
|
||
|
|
fmt.Printf("\n\n默认API运行地址:http://127.0.0.1%s\n", portStr)
|
||
|
|
runErr := startUp.ListenAndServe().Error()
|
||
|
|
panic(fmt.Errorf(runErr))
|
||
|
|
}
|