mchmarny / grpctest

Simple test app for GRPC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

grpctest

generate

proto

protoc \
    --proto_path=api/v1 \
    --proto_path=${GOOGLEAPIS_DIR} \
    --go_out=plugins=grpc:pkg/api/v1 \
    message.proto

gateway

protoc \
    --proto_path=api/v1 \
    --proto_path=${GOOGLEAPIS_DIR} \
    --grpc-gateway_out=logtostderr=true:pkg/api/v1 \
    message.proto

docs

protoc \
    --proto_path=api/v1 \
    --proto_path=${GOOGLEAPIS_DIR} \
    --swagger_out=logtostderr=true:api/swagger/v1 \
    message.proto

run

locally

go run cmd/server/main.go

cloud run on gke

kubectl apply -f deploy/service.yaml -n demo

client

local (grpc)

go run cmd/client/main.go --server=":8080" --name=John

local (rest)

curl http://localhost:7777/v1/say/mark

cloud run on gke

go run cmd/client/main.go \
    --server=grpctest.demo.knative.tech:8080 \
    --name=John

About

Simple test app for GRPC

License:Apache License 2.0


Languages

Language:Go 63.7%Language:Makefile 25.2%Language:Dockerfile 11.1%