-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
39 lines (35 loc) · 919 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"QA-System/internal/middleware"
mongodb "QA-System/internal/pkg/database/mongodb"
mysql "QA-System/internal/pkg/database/mysql"
"QA-System/internal/pkg/log"
"QA-System/internal/pkg/queue/asynq"
"QA-System/internal/pkg/session"
"QA-System/internal/router"
"QA-System/internal/service"
"github.com/gin-gonic/gin"
)
func main() {
// 初始化日志系统
log.ZapInit()
// 初始化数据库
db:=mysql.MysqlInit()
mdb:=mongodb.MongodbInit()
// 初始化dao
service.ServiceInit(db,mdb)
// 初始化gin
r := gin.Default()
r.Use(middlewares.ErrHandler())
r.NoMethod(middlewares.HandleNotFound)
r.NoRoute(middlewares.HandleNotFound)
r.Static("public/static", "./public/static")
r.Static("public/xlsx", "./public/xlsx")
session.Init(r)
router.Init(r)
go asynq.AsynqInit()
err := r.Run()
if err != nil {
log.Logger.Fatal("Failed to start the server:" + err.Error())
}
}