Git Product home page Git Product logo

grpcaesar's Introduction

🗡️gRPCaesar Microservice🗡️

Overview

gRPCaesar is a microservice built with gRPC. It has two components:

  1. gRPCaesar client: Written in Go, the client accepts input from command-line flags and makes a request to the Cipher service with that input.
  2. Cipher service: Written in Node.js, the service encodes or decodes the received text using the Caesar cipher encryption technique.

Service Description

The Cipher service interface defined in the cipher.proto file includes one simple RPC service method: ProcessMessage.

This method accepts a request consisting of a string text, an integer shift, and a boolean denoting encryption or decryption. It returns a response consisting of a string message.

Setting flag values

Flag Description Value Default Value
-t text, a quote-enclosed string "Et tu brute" "hello world"
-s shift, an integer 3 0
-m mode, a string character "e" or "d" (encode or decode) e e

For example:

./grpcaesar -t "Et tu brute" -s 3 -m e

Quickstart

Start server

cd service
npm install
node server.js

Start client

cd client
./grpcaesar -t "hi" -s 2 -m e    #encode "hi" with a shift of 2
./grpcaesar -t "jk" -s 2 -m d    #decode "jk" with a shift of 2

Rebuild the Go client executable

cd client
go build -o grpcaesar

Run the Go code without executable

cd client
go run main.go cipher.pb.go -t "hi" -s 2 -m e   #encode "hi" with a shift of 2

Run Go unit tests

cd client
go test

Learn more

For more information on gRPC with Node.js and Go, see the official gRPC documentation.

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.