Refine the directories.

This commit is contained in:
zicla
2019-04-26 02:30:04 +08:00
parent 61b14fe82b
commit b3c52ea50e
40 changed files with 214 additions and 162 deletions

12
main.go
View File

@ -6,16 +6,18 @@ import (
"log"
"net/http"
"tank/rest"
"tank/rest/config"
"tank/rest/tool"
)
func main() {
//日志第一优先级保障
rest.LOGGER.Init()
defer rest.LOGGER.Destroy()
tool.LOGGER.Init()
defer tool.LOGGER.Destroy()
//装载配置文件,这个决定了是否需要执行安装过程
rest.CONFIG.Init()
config.CONFIG.Init()
//全局运行的上下文
rest.CONTEXT.Init()
@ -23,9 +25,9 @@ func main() {
http.Handle("/", rest.CONTEXT.Router)
rest.LOGGER.Info("App started at http://localhost:%v", rest.CONFIG.ServerPort)
tool.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
dotPort := fmt.Sprintf(":%v", rest.CONFIG.ServerPort)
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
err1 := http.ListenAndServe(dotPort, nil)
if err1 != nil {
log.Fatal("ListenAndServe: ", err1)