grpc-promisify
v0.1.0
Published
Make gRPC client promisify
Downloads
1,874
Maintainers
Readme
grpc-promisify
gRPC is a high performance, open source, general-purpose RPC framework, grpc-promisify
make gRPC client promisify in node.
Installation
$ npm install grpc-promisify
##The Gist
const PROTO_PATH = __dirname + '/hello.proto';
const promisify = require('grpc-promisify');
const grpc = require('grpc');
const hello_proto = grpc.load(PROTO_PATH).helloworld;
function main() {
const client = new hello_proto.Greeter('localhost:50051', grpc.credentials.createInsecure());
const user = 'hello';
promisify(client);
client.sayHello({name: user})
.then(res => console.log(res.message))
.catch(err => console.error(err));
}
main();
License
The MIT license.