server.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package core
  2. import (
  3. "fmt"
  4. "time"
  5. "go.uber.org/zap"
  6. "log-server/global"
  7. "log-server/initialize"
  8. "log-server/service/system"
  9. )
  10. type server interface {
  11. ListenAndServe() error
  12. }
  13. func RunWindowsServer() {
  14. if global.GVA_CONFIG.System.UseMultipoint || global.GVA_CONFIG.System.UseRedis {
  15. // 初始化redis服务
  16. initialize.Redis()
  17. }
  18. // 从db加载jwt数据
  19. if global.GVA_DB != nil {
  20. system.LoadAll()
  21. }
  22. Router := initialize.Routers()
  23. Router.Static("/form-generator", "./resource/page")
  24. address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
  25. s := initServer(address, Router)
  26. // 保证文本顺序输出
  27. // In order to ensure that the text order output can be deleted
  28. time.Sleep(10 * time.Microsecond)
  29. global.GVA_LOG.Info("server run success on ", zap.String("address", address))
  30. fmt.Printf(`
  31. 欢迎使用 gin-vue-admin
  32. 当前版本:v2.5.3beta
  33. 加群方式:微信号:shouzi_1994 QQ群:622360840
  34. 插件市场:https://plugin.gin-vue-admin.com
  35. GVA讨论社区:https://support.qq.com/products/371961
  36. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  37. 默认前端文件运行地址:http://127.0.0.1:8080
  38. 如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
  39. `, address)
  40. global.GVA_LOG.Error(s.ListenAndServe().Error())
  41. }