All Projects → gogo → Grpc Example

gogo / Grpc Example

An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Grpc Example

Protoeasy Go
Simpler usage of protoc. Deprecated.
Stars: ✭ 129 (-63.35%)
Mutual labels:  grpc, grpc-gateway, protobuf
docker-protobuf
An all-inclusive protoc Docker image
Stars: ✭ 105 (-70.17%)
Mutual labels:  protobuf, grpc, grpc-gateway
Rules protobuf
Bazel rules for building protocol buffers and gRPC services (java, c++, go, ...)
Stars: ✭ 206 (-41.48%)
Mutual labels:  grpc, grpc-gateway, protobuf
Grpc Jersey
gRPC<->Jersey bridge
Stars: ✭ 23 (-93.47%)
Mutual labels:  grpc, grpc-gateway, protobuf
Clay
Proto-first minimal server platform for gRPС+REST+Swagger APIs
Stars: ✭ 212 (-39.77%)
Mutual labels:  grpc, grpc-gateway, protobuf
vtprotobuf
A Protocol Buffers compiler that generates optimized marshaling & unmarshaling Go code for ProtoBuf APIv2
Stars: ✭ 418 (+18.75%)
Mutual labels:  protobuf, grpc
tsrpc
A TypeScript RPC framework, with runtime type checking and serialization, support both HTTP and WebSocket. It is very suitable for website / APP / games, and absolutely comfortable to full-stack TypeScript developers.
Stars: ✭ 866 (+146.02%)
Mutual labels:  protobuf, grpc
api
Temporal gRPC API and proto files
Stars: ✭ 25 (-92.9%)
Mutual labels:  protobuf, grpc
Rejoiner
Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources
Stars: ✭ 3,432 (+875%)
Mutual labels:  grpc, protobuf
mnemosyne
Session management service with RPC API based on protobuf.
Stars: ✭ 15 (-95.74%)
Mutual labels:  protobuf, grpc
xrgrpc
gRPC library for Cisco IOS XR
Stars: ✭ 40 (-88.64%)
Mutual labels:  protobuf, grpc
Ts Proto
An idiomatic protobuf generator for TypeScript
Stars: ✭ 340 (-3.41%)
Mutual labels:  grpc, protobuf
nameko-grpc
GRPC Extensions for Nameko
Stars: ✭ 51 (-85.51%)
Mutual labels:  protobuf, grpc
protobuf-compiler
online protobuf compiler
Stars: ✭ 24 (-93.18%)
Mutual labels:  protobuf, grpc
grpcman
A grpc testing tool based on Electron & Vue.js & Element-UI
Stars: ✭ 22 (-93.75%)
Mutual labels:  protobuf, grpc
grpcoin
API-driven cryptocurrency paper trading game. Write a bot and play!
Stars: ✭ 53 (-84.94%)
Mutual labels:  protobuf, grpc
Ovpm
OpenVPN Management Server - Effortless and free OpenVPN server administration
Stars: ✭ 256 (-27.27%)
Mutual labels:  grpc, grpc-gateway
gruf-demo
A demonstration Rails application utilizing gruf, a gRPC Rails framework.
Stars: ✭ 42 (-88.07%)
Mutual labels:  protobuf, grpc
Turbo
A lightweight microservice tool, turn your grpc|thrift APIs into HTTP APIs!
Stars: ✭ 275 (-21.87%)
Mutual labels:  grpc, grpc-gateway
Flatbuffers
FlatBuffers: Memory Efficient Serialization Library
Stars: ✭ 17,180 (+4780.68%)
Mutual labels:  grpc, protobuf

gRPC-Example

Build Status

This repo is an example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.

OpenAPI UI in action

Installation

$ go get -u github.com/gogo/grpc-example

Running it

$ grpc-example
INFO: Serving gRPC on https://localhost:10000
INFO: parsed scheme: "passthrough"
INFO: ccResolverWrapper: sending new addresses to cc: [{localhost:10000 0  <nil>}]
INFO: ClientConn switching balancer to "pick_first"
INFO: pickfirstBalancer: HandleSubConnStateChange: 0xc420097cd0, CONNECTING
INFO: pickfirstBalancer: HandleSubConnStateChange: 0xc420097cd0, READY
INFO: Serving gRPC-Gateway on https://localhost:11000
INFO: Serving OpenAPI Documentation on https://localhost:11000/openapi-ui/

After starting the server, you can access the OpenAPI UI on https://localhost:11000/openapi-ui/

Development

To regenerate the proto files, ensure you have installed the generate dependencies:

$ GO111MODULE=on make install
go get \
        github.com/gogo/protobuf/protoc-gen-gogo \
        github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
        github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
        github.com/mwitkow/go-proto-validators/protoc-gen-govalidators \
        github.com/rakyll/statik
go: finding github.com/mwitkow/go-proto-validators/protoc-gen-govalidators latest
go: finding github.com/mwitkow/go-proto-validators latest
go: finding github.com/gogo/protobuf/protoc-gen-gogo latest
go: finding github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger latest
go: finding github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway latest

It also requires you to have the Google Protobuf compiler protoc installed. Please follow instructions for your platform on the official protoc repo.

Regenerate the files by running make generate:

$ make generate
# Generate gogo, gRPC-Gateway, swagger, go-validators output.
#
# -I declares import folders, in order of importance
# This is how proto resolves the protofile imports.
# It will check for the protofile relative to each of these
# folders and use the first one it finds.
#
# --gogo_out generates GoGo Protobuf output with gRPC plugin enabled.
# --grpc-gateway_out generates gRPC-Gateway output.
# --swagger_out generates an OpenAPI 2.0 specification for our gRPC-Gateway endpoints.
# --govalidators_out generates Go validation files for our messages types, if specified.
#
# The lines starting with Mgoogle/... are proto import replacements,
# which cause the generated file to import the specified packages
# instead of the go_package's declared by the imported protof files.
#
# $GOPATH/src is the output directory. It is relative to the GOPATH/src directory
# since we've specified a go_package option relative to that directory.
#
# proto/example.proto is the location of the protofile we use.
protoc \
        -I proto \
        -I vendor/github.com/grpc-ecosystem/grpc-gateway/ \
        -I vendor/github.com/gogo/googleapis/ \
        -I vendor/ \
        --gogo_out=plugins=grpc,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src/ \
        --grpc-gateway_out=allow_patch_feature=false,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src/ \
        --swagger_out=third_party/OpenAPI/ \
        --govalidators_out=gogoimport=true,\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\
Mgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\
$GOPATH/src \
        proto/example.proto
# Workaround for https://github.com/grpc-ecosystem/grpc-gateway/issues/229.
sed -i.bak "s/empty.Empty/types.Empty/g" proto/example.pb.gw.go && rm proto/example.pb.gw.go.bak
# Generate static assets for OpenAPI UI
statik -m -f -src third_party/OpenAPI/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].