This is a simple example of a gRPC server, written in Typescript, using:
- grpc-tools to generate the server and client code from the proto file
- @grpc/grpc-js to create the server and client
- grpc_tools_node_protoc_ts to generate the typescript types from the proto file
- ioredis to connect to Redis and store the data
git clone https://github.com/BalliAsghar/grpc-typescript-example
cd grpc-typescript-examplenpm installnpm run build:protoMake sure you have the protoc installed on your machine.
npm run devMake sure you have the Redis installed on your machine.
Use Postman or any other tool to test the server.
CreateProduct- Creates a new productGetProduct- Gets a product by idGetProducts- Gets all products