grpc-promise-client
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

grpc-promise-client

Wrapper around @grpc/grpc-js client that allows to use promises instead of callbacks.

Installation

npm i grpc-promise-client

Usage

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" });

Contributing

Contributions are always welcome!

License

Apache-2.0

Package Sidebar

Install

npm i grpc-promise-client

Weekly Downloads

205

Version

1.0.2

License

Apache-2.0

Unpacked Size

17.8 kB

Total Files

5

Last publish

Collaborators

  • infodusha