This project is a basic example of using gRPC with Node.js. It includes a gRPC server and client that exchange simple messages. The server offers four methods: SayHello
, SayGoodbye
, GetTime
, and MultiplyNumbers
.
helloworld.proto
- Defines the gRPC service and messages.server.js
- Implements the gRPC server.client.js
- A sample gRPC client that calls methods on the server.
To work with this project, you'll need Node.js and npm installed on your machine.
- Clone the repository:
git clone [repository URL]
- Navigate to the project directory:
cd [directory name]
- Install the required dependencies:
npm install
Run the following command to start the server:
node server.js
Open a new terminal and run the client:
node client.js
The client will send requests to the server, and you'll see the responses in the console.
SayHello
: Accepts a name as a parameter and returns a greeting message.SayGoodbye
: Accepts a name and returns a farewell message.GetTime
: Returns the current server time.MultiplyNumbers
: Accepts two numbers and returns their product.
You can modify the request parameters in client.js
and rerun the client to see different server responses.