Skip to content

A hybrid HTTP/GRPC microservice using GoKit, the service endpoints can be called with either protocol.

Notifications You must be signed in to change notification settings

kaizenlabs/gokit-grpc-http-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GRPC Proof Of Concept w/ GoKit - Lorem Ipsum Generator

This is proof of concept for a gRPC microserve using GoKit that generates lorem ipsum text between a minimum and maximum number of characters. Can generate words, sentences or paragraphs with the cmd flags on the client.

Installation

Step #1: Clone this repo...

$ git clone https://github.com/kaizenlabs/gokit-grpc-http-microservice.git

Step #2: Install dependencies...

$ cd $GOPATH/src/github.com/kaizenlabs/gokit-grpc-http-microservice
$ go mod download
$ go mod vendor

gRPC Usage

Step #1: Start the server...

$ go run $GOPATH/src/github.com/kaizenlabs/gokit-grpc-http-microservice/server/main.go

Step #2: Open another terminal window and run...

$ go run $GOPATH/src/github.com/kaizenlabs/gokit-grpc-http-microservice/client/main.go lorem sentence 10 1000

HTTP Usage

Step #1: While running the server, make a POST request to the following endpoint w/ Postman or curl:

localhost:8080/v1/lorem/{requestType}/{min}/{max}

WHERE:

  • requestType = (word|sentence|paragraph)
  • min = some positive integer
  • max = some positive integer

Example:

$ POST localhost:8080/v1/lorem/sentence/10/1000

For gRPC, use this format:

go run main.go lorem (word|sentence|paragraph) (minChars) (maxChars)

About

A hybrid HTTP/GRPC microservice using GoKit, the service endpoints can be called with either protocol.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages