@crayond_dev/grpc-toolkit
v1.15.109
Published
This has definitions and types required for implementing gRPC in toolkit microservices
Downloads
1,286
Readme
@crayond_dev/grpc-toolkit
Description
@crayond_dev/grpc-toolkit
is a toolkit for simplifying gRPC client and server setup in Node.js applications.
It provides utilities and helper functions to streamline the development of gRPC-based microservices.
Features
- Easily create gRPC clients and servers.
- Simplified gRPC method implementation.
- Helper functions for common gRPC tasks.
- Extensive documentation and examples.
Installation
You can install the package using npm or yarn:
npm install @crayond_dev/grpc-toolkit
# or
yarn add @crayond_dev/grpc-toolkit
Creating gRPC server
import { GRPCServer } from "@crayond_dev/grpc-toolkit";
const grpcServer: GRPCServer = new GRPCServer();
// append service handlers grpcServer.appendServices(service, pasmHandlerFunction)
grpcServer.listen();
Creating gRPC client
const client = new proto.service(
"localhost:50051",
grpc.credentials.createInsecure()
);
client.serviceFn({ foo: boo }, (error, response) => {
if (error) console.log(error);
console.log(response);
});