Files
full/module/ec/address/service/expose.go

28 lines
584 B
Go

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