forked from go-admin-team/go-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (34 loc) · 978 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
40
41
42
package main
import (
"github.com/gin-gonic/gin"
"go-admin/config"
orm "go-admin/database"
"go-admin/models"
"go-admin/router"
"log"
)
// @title go-admin API
// @version 0.0.1
// @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档
// @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢!
// @license.name MIT
// @license.url https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
func main() {
gin.SetMode(gin.DebugMode)
log.Println(config.DatabaseConfig.Port)
if config.ApplicationConfig.IsInit {
if err := models.InitDb(); err != nil {
log.Fatal("数据库初始化失败!")
} else {
config.SetApplicationIsInit()
}
}
r := router.InitRouter()
defer orm.Eloquent.Close()
if err := r.Run(config.ApplicationConfig.Host + ":" + config.ApplicationConfig.Port); err != nil {
log.Fatal(err)
}
}