蓝眼网盘定制版
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.

41 lines
914 B

package main
8 years ago
import (
"fmt"
"github.com/eyebluecn/tank/code/config"
"github.com/eyebluecn/tank/code/core"
"github.com/eyebluecn/tank/code/rest"
"github.com/eyebluecn/tank/code/support"
8 years ago
_ "github.com/go-sql-driver/mysql"
"log"
"net/http"
)
func main() {
//日志第一优先级保障
tankLogger := &support.TankLogger{}
tankLogger.Init()
defer tankLogger.Destroy()
core.LOGGER = tankLogger
//装载配置文件,这个决定了是否需要执行安装过程
config.CONFIG.Init()
//全局运行的上下文
tankContext := &rest.Context{}
tankContext.Init()
defer tankContext.Destroy()
core.CONTEXT = tankContext
8 years ago
http.Handle("/", core.CONTEXT)
8 years ago
core.LOGGER.Info("App started at http://localhost:%v", config.CONFIG.ServerPort)
8 years ago
dotPort := fmt.Sprintf(":%v", config.CONFIG.ServerPort)
err1 := http.ListenAndServe(dotPort, nil)
if err1 != nil {
log.Fatal("ListenAndServe: ", err1)
8 years ago
}
}