grpc-js-reflection-client
Version:
Package use Grpc reflection api to download grpc proto descriptor. Now you don't have to add proto file to each package. Simple direct download proto package from example microservice without any files.
21 lines (17 loc) • 544 B
JavaScript
const { GrpcReflection } = require('grpc-js-reflection-client');
const grpc = require('@grpc/grpc-js');
function getChannelCredentials() {
return grpc.ChannelCredentials.createSsl();
}
try {
(async()=> {
const client = new GrpcReflection(
'grpcb.in:9001',
getChannelCredentials(),
);
const methods = await client.listMethods('grpc.gateway.examples.examplepb.ABitOfEverythingService');
console.log(methods.map(method => method.name));
})();
}catch(e){
console.log(e)
}