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
857 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. time.Sleep(10 * time.Microsecond)
  25. global.GVA_LOG.Debug("server run success on ", address)
  26. fmt.Printf(`欢迎使用 Gin-Vue-Admin
  27. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  28. 默认前端文件运行地址:http://127.0.0.1:8080
  29. `, s.Addr)
  30. global.GVA_LOG.Error(s.ListenAndServe())
  31. }