// Server API for PhoneBook service type PhoneBookServer interface { CreateContact(context.Context, *CreateContactReq) (*CreateContactRes, error) } func RegisterPhoneBookServer(s *grpc.Server, srv PhoneBookServer) { s.RegisterService(&_PhoneBook_serviceDesc, srv) }
"golang.org/x/net/context" api "github.com/iheanyi/grpc-phonebook/api" ) // Use in-memory DB for simplicity type server struct { contactsByNameMu sync.RWMutex contactsByName map[string]*api.Contact }
PROTO_PATH = __dirname + '/../../api/api.proto'; var grpc = require('grpc'); var program = require('commander'); var path = require('path'); var api = grpc.load(path.resolve(PROTO_PATH)).api; var client = new api.PhoneBook('localhost:50051', grpc.credentials.createInsecure()); require('console.table'); var PhoneType = api.PhoneNumber.PhoneType; // end of file program.parse(process.argv);
https://github.com/improbable-eng/grpc-web – Improbable’s gRPC Web implementation • https://developers.google.com/protocol-buffers/docs/ proto3 - Protocol Buffers Documentation • https://github.com/grpc-ecosystem – GitHub Organization with various tools that integrate with gRPC