diff --git a/examples/grpc-js/helloworld_grpc_pb.js b/examples/grpc-js/helloworld_grpc_pb.js index 1e39a0f46ab..d96cae46c7d 100644 --- a/examples/grpc-js/helloworld_grpc_pb.js +++ b/examples/grpc-js/helloworld_grpc_pb.js @@ -18,7 +18,7 @@ 'use strict'; -const grpc = require('grpc'); +const grpc = require('@grpc/grpc-js'); const helloworld_pb = require('./helloworld_pb.js'); function serialize_HelloReply(arg) { diff --git a/examples/grpc-js/server.js b/examples/grpc-js/server.js index 1b9d5331728..1d71833ff1a 100644 --- a/examples/grpc-js/server.js +++ b/examples/grpc-js/server.js @@ -2,7 +2,7 @@ const tracer = require('./tracer')(('example-grpc-server')); // eslint-disable-next-line import/order -const grpc = require('grpc'); +const grpc = require('@grpc/grpc-js'); const messages = require('./helloworld_pb'); const services = require('./helloworld_grpc_pb'); @@ -14,9 +14,10 @@ function startServer() { // Creates a server const server = new grpc.Server(); server.addService(services.GreeterService, { sayHello }); - server.bind(`0.0.0.0:${PORT}`, grpc.ServerCredentials.createInsecure()); - console.log(`binding server on 0.0.0.0:${PORT}`); - server.start(); + server.bindAsync(`0.0.0.0:${PORT}`, grpc.ServerCredentials.createInsecure(), () => { + console.log(`binding server on 0.0.0.0:${PORT}`); + server.start(); + }); } function sayHello(call, callback) {