Skip to content

Commit b76df8e

Browse files
fix: require grpc-js instead of grpc in grpc-js example (#1364)
Co-authored-by: Bartlomiej Obecny <[email protected]>
1 parent b7d6e74 commit b76df8e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

examples/grpc-js/helloworld_grpc_pb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
'use strict';
2020

21-
const grpc = require('grpc');
21+
const grpc = require('@grpc/grpc-js');
2222
const helloworld_pb = require('./helloworld_pb.js');
2323

2424
function serialize_HelloReply(arg) {

examples/grpc-js/server.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const tracer = require('./tracer')(('example-grpc-server'));
44
// eslint-disable-next-line import/order
5-
const grpc = require('grpc');
5+
const grpc = require('@grpc/grpc-js');
66

77
const messages = require('./helloworld_pb');
88
const services = require('./helloworld_grpc_pb');
@@ -14,9 +14,10 @@ function startServer() {
1414
// Creates a server
1515
const server = new grpc.Server();
1616
server.addService(services.GreeterService, { sayHello });
17-
server.bind(`0.0.0.0:${PORT}`, grpc.ServerCredentials.createInsecure());
18-
console.log(`binding server on 0.0.0.0:${PORT}`);
19-
server.start();
17+
server.bindAsync(`0.0.0.0:${PORT}`, grpc.ServerCredentials.createInsecure(), () => {
18+
console.log(`binding server on 0.0.0.0:${PORT}`);
19+
server.start();
20+
});
2021
}
2122

2223
function sayHello(call, callback) {

0 commit comments

Comments
 (0)