Skip to content

Latest commit

 

History

History
103 lines (87 loc) · 1.68 KB

README.md

File metadata and controls

103 lines (87 loc) · 1.68 KB

Donut RPC

donut

a fake donut store built using grpc and sqlite

Setup

pull the docker container

docker pull ghcr.io/s1ntaxe770r/donut-store:latest

start the service

docker run -p 5050:5050 9052:9052 -d donut-store:latest

Testing

to test the service install grpcurl

go install github.com/fullstorydev/grpcurl/cmd/grpcurl

List the methods

grpcurl -plaintext  localhost:5050 DonutShop

sample response

DonutShop.GetDonut
DonutShop.GetDonuts
DonutShop.GetVersion
DonutShop.MakeDonut

Method (DonutShop.GetDonuts)

grpcurl -plaintext localhost:5050 DonutShop/GetDonuts 

sample response

{
  "donuts": [
    {
      "name": "bagel",
      "price": 32,
      "image": "https://none.com/bagel",
      "id": "1"
    },
    {
      "name": "glazed donut",
      "price": 32,
      "image": "https://none.com/bagel",
      "id": "3"
    },
  ]
}

Method (DonutShop.GetDonut)

grpcurl -d '{"name":"bagel"}'  -plaintext  localhost:5050 DonutShop/GetDonut

sample response

{
  "name": "bagel",
  "price": 32,
  "image": "https://none.com/bagel",
  "id": "1"
}

Method (DonutShop.GetVersion)

grpcurl -d '{}'  -plaintext  localhost:5050 DonutShop/GetVersion

sample response

{
  "number": "v0.1"
}

Method (DonutShop.MakeDonut)

grpcurl -d '{"name":"bagel","price":32,"image":"https://none.com/bagel","id":"001"}'  -plaintext  localhost:5050 DonutShop/MakeDonut
{
  "name": "bagel"
}

Accessing metrics

curl http://localhost:9092/metrics