Rename rest to code.
This commit is contained in:
35
code/main/main.go
Normal file
35
code/main/main.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"log"
|
||||
"net/http"
|
||||
"tank/code"
|
||||
"tank/code/config"
|
||||
"tank/code/logger"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
//日志第一优先级保障
|
||||
logger.LOGGER.Init()
|
||||
defer logger.LOGGER.Destroy()
|
||||
|
||||
//装载配置文件,这个决定了是否需要执行安装过程
|
||||
config.CONFIG.Init()
|
||||
|
||||
//全局运行的上下文
|
||||
code.CONTEXT.Init()
|
||||
defer code.CONTEXT.Destroy()
|
||||
|
||||
http.Handle("/", code.CONTEXT.Router)
|
||||
|
||||
logger.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
|
||||
|
||||
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
|
||||
err1 := http.ListenAndServe(dotPort, nil)
|
||||
if err1 != nil {
|
||||
log.Fatal("ListenAndServe: ", err1)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user