You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcmain() {
r:=gin.Default()
cr:=&custom.CustmoRouter{IRouter: r}
customRclt.InitCustmoR(cr)
UseContentRouter(cr)
_=r.Run(":9999")
}
funcUseContentRouter(r*custom.CustmoRouter) {
a:=r.GroupC("/api")
{
hole:=a.GroupC("/hole")
{
// the second handler must be type of RequestHandler// handlers after the second must be type of gin.HandlerFunc// gin.HandlerFunc will excute firsthole.GETC("/hello",&HelloRequest{} ,Hello)
}
}
}
funcHello(ctx*gin.Context) (statusCode*http_status.HttpStatus, jsoninterface{}) {
return&http_status.HttpStatus{
Msg: "error",
// custmo http error code// it always return 500// code msg will show in msgCode: common.HOLE_NOT_FOUND,
}, gin.H{
"msg": "hello",
}
}
funcInitCustmoR(cr*custom.CustmoRouter) {
logSettings:=config.Conf.LogSettingscustomize_router.InitCustomRouter(¢ralog.LogOptions{
Server: logSettings.LogCenterHost,
Db: logSettings.Db,
Collection: logSettings.Collection,
},cr)
}