I'm using node version upper 20 and I faced deprecation warning in the GRPC file in this line of code exactly below the problem inlines with server.start():
function main() {
var server = new grpc.Server();
server.addService(hello_proto.Greeter.service, {sayHello: sayHello});
server.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), (error, port) => {
if (error) {
console.error(`Server binding failed: ${error.message}`);
return;
}
console.log(`Server running at http://0.0.0.0:${port}`);
// server.start()
});
}
I need to know what's the alternative way to start the server.
The only change you need to make to address that warning is to remove the call to server.start()
.