Giter Site home page Giter Site logo

grpc-test's Introduction

gRPC Hello World Example with Node.js

Description

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.

Project Structure

  • 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.

Requirements

To work with this project, you'll need Node.js and npm installed on your machine.

Installation

  1. Clone the repository:
    git clone [repository URL]
    
  2. Navigate to the project directory:
    cd [directory name]
    
  3. Install the required dependencies:
    npm install
    

Running the Application

Starting the Server

Run the following command to start the server:

node server.js

Running the Client

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.

Service Methods

  • 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.

Testing

You can modify the request parameters in client.js and rerun the client to see different server responses.

grpc-test's People

Contributors

melnioks avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.