init the project

This commit is contained in:
Zic
2017-12-23 18:02:11 +08:00
commit 81e14d12ea
54 changed files with 6829 additions and 0 deletions

29
main.go Normal file
View File

@ -0,0 +1,29 @@
package main
import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"log"
"net/http"
"tank/rest"
)
func main() {
//将运行时参数装填到config中去。
rest.PrepareConfigs()
context := rest.NewContext()
defer context.Destroy()
http.Handle("/", context.Router)
dotPort := fmt.Sprintf(":%v", rest.CONFIG.ServerPort)
info := fmt.Sprintf("App started at http://localhost%v", dotPort)
rest.LogInfo(info)
err := http.ListenAndServe(dotPort, nil)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}