fanchann / grpc_math

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grpc math

  • server
    url : localhost:4040

  • client
    url : localhost:8080

Add

curl -X GET http://localhost:8080/add/1/1

2xx

{
  "success": true,
  "data": {
    "result": 2
  }
}

4xx

{
  "success": false,
  "data": {
    "error_msg":{}
  }
}

Multiply

curl -X GET http://localhost:8080/mul/2/2

2xx

{
  "success": true,
  "data": {
    "result": 4
  }
}

4xx

{
  "success": false,
  "data": {
    "error_msg":{}
  }
}

Divide

curl -X GET http://localhost:8080/div/20/4

2xx

{
  "success": true,
  "data": {
    "result": 5
  }
}

4xx

{
  "success": false,
  "data": {
    "error_msg":{}
  }
}

Reduce

curl -X GET http://localhost:8080/red/100/1

2xx

{
  "success": true,
  "data": {
    "result": 99
  }
}

4xx

{
  "success": false,
  "data": {
    "error_msg":{}
  }
}

Running End To End test

  • turn on grpc server with command :
make server.on
  • don't forget also turn on client :
make client.on
  • running test
go test -v -run=. github.com/fanchann/grpc_math/tests

About


Languages

Language:Go 98.0%Language:Makefile 2.0%