2022-01-19 19:39:04 +08:00
|
|
|
package servesr
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"git.icechen.cn/monorepo/backend/pkg/proto/brahma/murders"
|
|
|
|
"git.icechen.cn/monorepo/backend/pkg/rpc"
|
|
|
|
ctxLogger "github.com/luizsuper/ctxLoggers"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
func RpcServer() {
|
2022-01-23 14:48:44 +08:00
|
|
|
lis, err := net.Listen("tcp", ":3001")
|
2022-01-19 19:39:04 +08:00
|
|
|
if err != nil {
|
|
|
|
ctxLogger.Info(nil, "brahma server start up error", zap.String("error", err.Error()))
|
|
|
|
}
|
|
|
|
s := grpc.NewServer(grpc.UnaryInterceptor(rpc.Interceptor))
|
|
|
|
murders.RegisterMurdersServer(s, &Script{})
|
|
|
|
fmt.Println("lark server run in :3000")
|
|
|
|
if err := s.Serve(lis); err != nil {
|
|
|
|
ctxLogger.Info(nil, "brahma server start up error", zap.String("error", err.Error()))
|
|
|
|
}
|
|
|
|
}
|