I'm running gRPC server that implements the service interface and a Envoy proxy that allows the client to connect, the following js code (file health.js
) builded using webpack and referenced dist/main.js
into HTML file make success call and it's work
const { HealthCheckRequest, HealthCheckReply } = require("./protobuf/service_pb")
const { ProtoClient } = require("./protobuf/service_grpc_web_pb")
var client = new ProtoClient('http://localhost:8080');
var request = new HealthCheckRequest()
client.healthCheck(request, {}, (err, response) => {
console.log(response)
})
I would like to execute this function in a NodeJS server and not in a browser, in fact executing the command node health.js
the following error occurred
...
ReferenceError: XMLHttpRequest is not defined
...