Last active
March 25, 2020 11:39
-
-
Save skynet86/7ed56c7750a18233f14a0fba966c6bd2 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 sayHello(call, callback) { | |
var reply = new messages.HelloReply(); | |
reply.setMessage('Hello ' + call.request.getName()); | |
callback(null, reply); | |
} | |
function main() { | |
var server = new grpc.Server(); | |
server.addService(services.GreeterService, {sayHello: sayHello}); | |
server.bind('0.0.0.0:50051', grpc.ServerCredentials.createInsecure()); | |
server.start(); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment