windows.go 756 B

12345678910111213141516171819202122232425262728293031
  1. package cmd
  2. import (
  3. "fmt"
  4. "gin-vue-admin/config"
  5. "gin-vue-admin/init/initlog"
  6. "github.com/gin-gonic/gin"
  7. "net/http"
  8. "time"
  9. )
  10. func RunWindowsServer(Router *gin.Engine) {
  11. address := fmt.Sprintf(":%d", config.GinVueAdminconfig.System.Addr)
  12. s := &http.Server{
  13. Addr: address,
  14. Handler: Router,
  15. ReadTimeout: 10 * time.Second,
  16. WriteTimeout: 10 * time.Second,
  17. MaxHeaderBytes: 1 << 20,
  18. }
  19. time.Sleep(10 * time.Microsecond)
  20. log.L.Debug("server run success on ", address)
  21. fmt.Printf(`欢迎使用 Gin-Vue-Admin
  22. 作者:奇淼 And Spike666
  23. 微信:shouzi_1994
  24. 默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
  25. 默认前端文件运行地址:http://127.0.0.1:8080
  26. `, s.Addr)
  27. _ = s.ListenAndServe()
  28. }