mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-21 09:19:01 +08:00
rpc mw
This commit is contained in:
+4
-25
@@ -3,23 +3,24 @@ package api
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/log"
|
||||
"OpenIM/pkg/common/middleware"
|
||||
"OpenIM/pkg/common/mw"
|
||||
"OpenIM/pkg/common/prome"
|
||||
"github.com/OpenIMSDK/openKeeper"
|
||||
"github.com/gin-gonic/gin"
|
||||
"google.golang.org/grpc"
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
func NewGinRouter() *gin.Engine {
|
||||
openKeeper.DefaultOptions = []grpc.DialOption{mw.GrpcClient()} // 默认RPC中间件
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
f, _ := os.Create("../logs/api.log")
|
||||
gin.DefaultWriter = io.MultiWriter(f)
|
||||
// gin.SetMode(gin.DebugMode)
|
||||
r := gin.New()
|
||||
r.Use(gin.Recovery())
|
||||
r.Use(middleware.GinParseOperationID)
|
||||
log.Info("load config: ", config.Config)
|
||||
r.Use(gin.Recovery(), mw.CorsHandler(), mw.GinParseOperationID())
|
||||
if config.Config.Prometheus.Enable {
|
||||
prome.NewApiRequestCounter()
|
||||
prome.NewApiRequestFailedCounter()
|
||||
@@ -148,25 +149,3 @@ func NewGinRouter() *gin.Engine {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
{
|
||||
GetSeq
|
||||
SendMsg
|
||||
PullMsgBySeqList
|
||||
DelMsg
|
||||
DelSuperGroupMsg
|
||||
ClearMsg
|
||||
SetMsgMinSeq
|
||||
SetMessageReactionExtensions
|
||||
GetMessageListReactionExtensions
|
||||
AddMessageReactionExtensions
|
||||
DeleteMessageReactionExtensions
|
||||
ManagementSendMsg
|
||||
ManagementBatchSendMsg
|
||||
CheckMsgIsSendSuccess
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user