Wrapper around @grpc/grpc-js
client that allows to use promises instead of callbacks.
npm i grpc-promise-client
import { credentials } from "@grpc/grpc-js";
import { grpcClientFactory } from "grpc-promise-client";
import { BookServiceClient } from "./book_grpc_pb";
const createGrpcClient = grpcClientFactory({
defaultAddress: "localhost:50000",
credentials: credentials.createInsecure(),
});
const bookService = createGrpcClient(BookServiceClient);
const res = await bookService.getBook({ name: "Harry Potter" });
Contributions are always welcome!