In the example you linked, they import the service client class using this line:
import { GreeterService } from "./my_generated_code/helloworld_grpc_pb";
In this case, GreeterService
is the name of the service client class. In the generated code in this question, the service client class is named ApiServiceClient
. So, you should use a similar import line:
import { ApiServiceClient } from "./src/proto/api_grpc_pb";
This should replace this import line in your client code file:
import services from "./src/proto/api_grpc_pb";`
In addition, you should not construct a grpc.Client
object directly. That will not have the generated code for the service, so you will not be able to make any requests to any methods. You should instead construct the generated service client class:
const client = new ApiServiceClient("localhost:8082",grpc.credentials.createInsecure());