Created
March 25, 2020 11:19
-
-
Save skynet86/5549232fb45bbf809dd71b489ac1a397 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var messages = require('./helloworld_pb'); | |
var services = require('./helloworld_grpc_pb'); | |
var grpc = require('grpc'); | |
function main() { | |
var client = new services.GreeterClient('localhost:50051', | |
grpc.credentials.createInsecure()); | |
var request = new messages.HelloRequest(); | |
var user; | |
if (process.argv.length >= 3) { | |
user = process.argv[2]; | |
} else { | |
user = 'world'; | |
} | |
request.setName(user); | |
client.sayHello(request, function(err, response) { | |
console.log('Greeting:', response.getMessage()); | |
}); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment