gin-vue-admin 2.0代码重构
This commit is contained in:
34
server/core/server.go
Normal file
34
server/core/server.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/init"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RunWindowsServer() {
|
||||
if global.GVA_CONFIG.System.UseMultipoint {
|
||||
// 初始化redis服务
|
||||
init.RegisterRedis()
|
||||
}
|
||||
Router := init.RegisterRouter()
|
||||
Router.Static("/form-generator", "./resource/page")
|
||||
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
|
||||
s := &http.Server{
|
||||
Addr: address,
|
||||
Handler: Router,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
MaxHeaderBytes: 1 << 20,
|
||||
}
|
||||
time.Sleep(10 * time.Microsecond)
|
||||
init.L.Debug("server run success on ", address)
|
||||
|
||||
fmt.Printf(`欢迎使用 Gin-Vue-Admin
|
||||
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
|
||||
默认前端文件运行地址:http://127.0.0.1:8080
|
||||
`, s.Addr)
|
||||
init.L.Error(s.ListenAndServe())
|
||||
}
|
Reference in New Issue
Block a user