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.

43 lines
1.3 KiB

  1. package main
  2. import (
  3. "gin-vue-admin/cmd"
  4. "gin-vue-admin/config"
  5. "gin-vue-admin/init/initRedis"
  6. "gin-vue-admin/init/initRouter"
  7. "gin-vue-admin/init/qmlog"
  8. "gin-vue-admin/init/qmsql"
  9. "gin-vue-admin/init/registTable"
  10. //"runtime"
  11. )
  12. // @title Swagger Example API
  13. // @version 0.0.1
  14. // @description This is a sample Server pets
  15. // @securityDefinitions.apikey ApiKeyAuth
  16. // @in header
  17. // @name x-token
  18. // @BasePath /
  19. func main() {
  20. qmlog.InitLog() // 初始化日志
  21. db := qmsql.InitMysql(config.GinVueAdminconfig.MysqlAdmin) // 链接初始化数据库
  22. if config.GinVueAdminconfig.System.UseMultipoint {
  23. _ = initRedis.InitRedis() // 初始化redis服务
  24. }
  25. registTable.RegistTable(db) // 注册数据库表
  26. defer qmsql.DEFAULTDB.Close() // 程序结束前关闭数据库链接
  27. Router := initRouter.InitRouter() // 注册路由
  28. qmlog.QMLog.Info("服务器开启") // 日志测试代码
  29. //Router.RunTLS(":443","ssl.pem", "ssl.key") // https支持 需要添加中间件
  30. //sysType := runtime.GOOS
  31. //
  32. //if sysType == "linux" {
  33. // // LINUX系统
  34. // // 借助endless开发无感知重启后台 以及前端接口重启后台功能
  35. //}
  36. //if sysType == "windows" {
  37. // WIN系统
  38. cmd.RunWindowsServer(Router)
  39. //}
  40. }