Files
full/module/base/initial/service/expose.go

29 lines
645 B
Go

package service
import (
"context"
"bsm/full/module/base/initial/internal/server"
pb "bsm/full/module/base/initial/pb"
gwRuntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
)
type ExposeOptions struct {
GRPC *grpc.Server
Gateway *gwRuntime.ServeMux
}
func Expose(options ExposeOptions) error {
server.New(options.GRPC)
ctx := context.Background()
if err := pb.RegisterCheckHandlerServer(ctx, options.Gateway, server.NewCheckServer()); err != nil {
return err
}
if err := pb.RegisterDataHandlerServer(ctx, options.Gateway, server.NewDataServer()); err != nil {
return err
}
return nil
}