gRPC NodeJS如何获取所有方法的列表

时间:2021-03-02 19:33:56

I want to get a list of all methods (gPRC methods name) for server in gRPC. I didn't find methods or property in NodeJS gRPC references to get list of gRPC methods - https://grpc.io/grpc/node/grpc.Server.html. How can I do this? Thanks)

我想获得gRPC中服务器的所有方法(gPRC方法名称)的列表。我没有在NodeJS gRPC引用中找到方法或属性来获取gRPC方法列表 - https://grpc.io/grpc/node/grpc.Server.html。我怎样才能做到这一点?谢谢)

1 个解决方案

#1


0  

const Service = grpc.load(protoPath).examplePackage.exampleService;
// your methods:
const methods = Object.keys(Service.prototype);

I got the solution from here

我从这里得到了解决方案

#1


0  

const Service = grpc.load(protoPath).examplePackage.exampleService;
// your methods:
const methods = Object.keys(Service.prototype);

I got the solution from here

我从这里得到了解决方案