引入日志初始化中间件
This commit is contained in:
parent
3774bda0ff
commit
593df47884
@ -10,6 +10,7 @@ package router
|
||||
import (
|
||||
"fmt"
|
||||
apiDoc "git.zhangdeman.cn/gateway/api-doc"
|
||||
"git.zhangdeman.cn/zhangdeman/gin/middleware"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@ -26,8 +27,16 @@ func NewServer(port int, option any) *server {
|
||||
if port < 80 {
|
||||
panic("port should be greater than 80")
|
||||
}
|
||||
r := gin.Default()
|
||||
r.Use(
|
||||
// 初始化请求
|
||||
middleware.InitRequest(),
|
||||
/*request_cors.New(request_cors.Config{
|
||||
AllowAllOrigins: true,
|
||||
}), */// middleware.Ac
|
||||
)
|
||||
return &server{
|
||||
router: gin.Default(),
|
||||
router: r,
|
||||
uiInstance: apiDoc.NewSwaggerUI(nil, []*apiDocDefine.ServerItem{
|
||||
{
|
||||
Url: fmt.Sprintf("http://127.0.0.1:%d", port),
|
||||
|
Loading…
x
Reference in New Issue
Block a user