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.

34 lines
967 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. package main
  2. import (
  3. "github.com/flipped-aurora/gin-vue-admin/server/core"
  4. "github.com/flipped-aurora/gin-vue-admin/server/global"
  5. "github.com/flipped-aurora/gin-vue-admin/server/initialize"
  6. )
  7. //go:generate go env -w GO111MODULE=on
  8. //go:generate go env -w GOPROXY=https://goproxy.cn,direct
  9. //go:generate go mod tidy
  10. //go:generate go mod download
  11. // @title Swagger Example API
  12. // @version 0.0.1
  13. // @description This is a sample Server pets
  14. // @securityDefinitions.apikey ApiKeyAuth
  15. // @in header
  16. // @name x-token
  17. // @BasePath /
  18. func main() {
  19. global.GVA_VP = core.Viper() // 初始化Viper
  20. global.GVA_LOG = core.Zap() // 初始化zap日志库
  21. global.GVA_DB = initialize.Gorm() // gorm连接数据库
  22. initialize.Timer()
  23. initialize.DBList()
  24. if global.GVA_DB != nil {
  25. initialize.RegisterTables(global.GVA_DB) // 初始化表
  26. // 程序结束前关闭数据库链接
  27. db, _ := global.GVA_DB.DB()
  28. defer db.Close()
  29. }
  30. core.RunWindowsServer()
  31. }