server.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package core
  2. import (
  3. "fmt"
  4. "time"
  5. "github.com/flipped-aurora/gin-vue-admin/server/global"
  6. "github.com/flipped-aurora/gin-vue-admin/server/initialize"
  7. "go.uber.org/zap"
  8. )
  9. type server interface {
  10. ListenAndServe() error
  11. }
  12. func RunWindowsServer() {
  13. if global.GVA_CONFIG.System.UseMultipoint {
  14. // 初始化redis服务
  15. initialize.Redis()
  16. }
  17. Router := initialize.Routers()
  18. Router.Static("/form-generator", "./resource/page")
  19. address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
  20. s := initServer(address, Router)
  21. // 保证文本顺序输出
  22. // In order to ensure that the text order output can be deleted
  23. time.Sleep(10 * time.Microsecond)
  24. global.GVA_LOG.Info("server run success on ", zap.String("address", address))
  25. fmt.Printf(`
  26. 欢迎使用 github.com/flipped-aurora/gin-vue-admin/server
  27. 当前版本:V2.4.5 alpha
  28. 加群方式:微信号:shouzi_1994 QQ群:622360840
  29. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  30. 默认前端文件运行地址:http://127.0.0.1:8080
  31. 如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.github.com/flipped-aurora/gin-vue-admin/server.com/docs/coffee
  32. `, address)
  33. global.GVA_LOG.Error(s.ListenAndServe().Error())
  34. }