main_dummy

package module
v0.0.0-...-a4b7a9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

README

Simple gRPC Example

This example has two goals:

  1. To show a simplistic gRPC client and server in Go.
  2. To show a possible directory layout and build (Makefile) strategy.

Note that meeting only goal 1 could simplify the example to three files in a single directory -- this would not build with go build as there would be two executables in the directory. Rather this example attempts to also show a starting point for code layout suitable for a small project. Versioned APIs are not tackled here.

Prerequisites

  1. protoc installed and in your $PATH. The protocol buffer compiler.

  2. protoc-gen-go installed and in your $PATH. The plugin for Golang.

Usage

Build
> make build
(cd cmd/server; go build)
(cd cmd/client; go build)
ln -sf cmd/server/server .
ln -sf cmd/client/client .
>
Running

In two separate windows, client and server.

Server: (press ctl-C to exit)

> ./server
Go gRPC Tutorial
2021/01/20 15:50:51 Receive message body from client: Hello From Client.

Client:

> ./client
2021/01/20 15:50:51 response:  Hello from the Server
>

Citations & Reference

gRPC and protoc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL