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.

36 lines
951 B

  1. package core
  2. import (
  3. "fmt"
  4. "gin-vue-admin/global"
  5. "gin-vue-admin/initialize"
  6. "net/http"
  7. "time"
  8. )
  9. func RunWindowsServer() {
  10. if global.GVA_CONFIG.System.UseMultipoint {
  11. // 初始化redis服务
  12. initialize.Redis()
  13. }
  14. Router := initialize.Routers()
  15. Router.Static("/form-generator", "./resource/page")
  16. address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
  17. s := &http.Server{
  18. Addr: address,
  19. Handler: Router,
  20. ReadTimeout: 10 * time.Second,
  21. WriteTimeout: 10 * time.Second,
  22. MaxHeaderBytes: 1 << 20,
  23. }
  24. // 保证文本顺序输出
  25. // In order to ensure that the text order output can be deleted
  26. time.Sleep(10 * time.Microsecond)
  27. global.GVA_LOG.Debug("server run success on ", address)
  28. fmt.Printf(`欢迎使用 Gin-Vue-Admin
  29. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  30. 默认前端文件运行地址:http://127.0.0.1:8080
  31. `, s.Addr)
  32. global.GVA_LOG.Error(s.ListenAndServe())
  33. }