fix version 1
This commit is contained in:
26
module/social/feed/service/expose.go
Normal file
26
module/social/feed/service/expose.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"bsm/full/module/social/feed/internal/server"
|
||||
gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type ExposeOptions struct {
|
||||
Dependencies
|
||||
GRPC *grpc.Server
|
||||
Gateway *gwRuntime.ServeMux
|
||||
}
|
||||
|
||||
// Expose 供聚合宿主接入:注册 gRPC service 与网关路由
|
||||
func Expose(options ExposeOptions) error {
|
||||
applyDependencies(options.Dependencies)
|
||||
server.New(options.GRPC)
|
||||
|
||||
if options.Gateway == nil {
|
||||
return nil
|
||||
}
|
||||
return server.RegisterGateway(context.Background(), options.Gateway)
|
||||
}
|
||||
Reference in New Issue
Block a user