main.go 572 字节
Newer Older
Mr.奇淼('s avatar
Mr.奇淼( 已提交
1 2 3 4
package main

import (
	"main/config"
5
	"main/init/initRouter"
Mr.奇淼('s avatar
Mr.奇淼( 已提交
6 7
	"main/init/qmlog"
	"main/init/qmsql"
8
	"main/init/registTable"
Mr.奇淼('s avatar
Mr.奇淼( 已提交
9 10 11 12 13
	"net/http"
	"time"
)

func main() {
Mr.奇淼('s avatar
Mr.奇淼( 已提交
14 15 16
	qmlog.InitLog()
	registTable.RegistTable(qmsql.InitMysql(config.Dbconfig.Admin))
	defer qmsql.DEFAULTDB.Close()
17
	Router := initRouter.InitRouter()
Mr.奇淼('s avatar
Mr.奇淼( 已提交
18
	//qmlog.QMLog.Info("服务器开启") // 日志测试代码
Mr.奇淼('s avatar
Mr.奇淼( 已提交
19 20
	s := &http.Server{
		Addr:           ":8888",
21
		Handler:        Router,
Mr.奇淼('s avatar
Mr.奇淼( 已提交
22 23 24 25 26 27
		ReadTimeout:    10 * time.Second,
		WriteTimeout:   10 * time.Second,
		MaxHeaderBytes: 1 << 20,
	}
	_ = s.ListenAndServe()
}