Fetch the repository succeeded.
This action will force synchronization from hequan/go-admin, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
package main
import (
"fmt"
"go-admin/middleware/inject"
"go-admin/pkg/setting"
"go-admin/routers"
"log"
"net/http"
)
// @title go-admin
// @version 2.0
// @description go-admin
// @termsOfService https://github.com/hequan2017/go-admin
// @contact.name hequan
// @contact.url https://github.com/hequan2017
// @contact.email hequan2011@sina.com
// @license.name MIT
// @license.url https://github.com/hequan2017/go-admin/blob/master/LICENSE
// @host 127.0.0.1:8000
// @BasePath
func main() {
err := inject.LoadCasbinPolicyData()
if err != nil {
panic("加载casbin策略数据发生错误: " + err.Error())
}
routersInit := routers.InitRouter()
readTimeout := setting.ServerSetting.ReadTimeout
writeTimeout := setting.ServerSetting.WriteTimeout
endPoint := fmt.Sprintf(":%d", setting.ServerSetting.HttpPort)
maxHeaderBytes := 1 << 20
server := &http.Server{
Addr: endPoint,
Handler: routersInit,
ReadTimeout: readTimeout,
WriteTimeout: writeTimeout,
MaxHeaderBytes: maxHeaderBytes,
}
log.Printf("[info] start http server listening %s", endPoint)
_ = server.ListenAndServe()
// If you want Graceful Restart, you need a Unix system and download github.com/fvbock/endless
//endless.DefaultReadTimeOut = readTimeout
//endless.DefaultWriteTimeOut = writeTimeout
//endless.DefaultMaxHeaderBytes = maxHeaderBytes
//server := endless.NewServer(endPoint, routersInit)
//server.BeforeBegin = func(add string) {
// log.Printf("Actual pid is %d", syscall.Getpid())
//}
//
//err := server.ListenAndServe()
//if err != nil {
// log.Printf("Server err: %v", err)
//}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。