Code Monkey home page Code Monkey logo

grpcexample's Introduction

gRPC Implementation Example

This is a example showing how you can create a service using gRPC.

This code was written as a example only and does not follow any good practice rules, since it wasn't on the scope of this presentation.

Requirements

  • Python 3.9.X (This should work as-is in python 3.10.X)
  • Node v17.3.0

Server

To start the gRPC server just execute the following command:

  1. $ python -m venv venv
  2. $ pip install -r requirements.txt
  3. $ python -m server.main

This will start an insecure gRPC server on https://0.0.0.0:50051

ps.: This server uses an insecure channel for communications, although this is not a problem for learning purposes this SHOULD NOT be used as-is in production.

ps².: The creation of a secure channel communication is beyond the scope of this example.

Node client

To start the node.js client execute the following commands:

  1. $ cd client_node
  2. $ yarn (or $ npm install)
  3. $ yarn start (or $ npm start)

This will start a client Express app on http://localhost:3000

A file containing some requests examples can be found here.

Python client

To start the python client execute the following command:

  1. $ uvicorn client_python.main:app --reload

This will start a client FastAPI app on http://localhost:8000

A file containing some requests examples can be found here.

grpcexample's People

Contributors

rapheer avatar

Stargazers

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