George Barnett 2ed95d8573 Update dependency requirements and docs (#2188) il y a 10 mois
..
Sources 9639fe95bd Use the protoc build plugin in examples (#2171) il y a 10 mois
.gitignore cf29048827 Make examples standalone packages (#2067) il y a 1 an
Package.swift 2ed95d8573 Update dependency requirements and docs (#2188) il y a 10 mois
README.md bfe033fbdd Update Example READMEs (#2179) il y a 10 mois

README.md

Hello World

This example demonstrates the canonical "Hello World" in gRPC.

Overview

A "hello-world" command line tool that uses generated stubs for the 'Greeter' service which allows you to start a server and to make requests against it.

The tool uses the SwiftNIO HTTP/2 transport.

Prerequisites

You must have the Protocol Buffers compiler (protoc) installed. You can find the instructions for doing this in the gRPC Swift Protobuf documentation. The swift commands below are all prefixed with PROTOC_PATH=$(which protoc), this is to let the build system know where protoc is located so that it can generate stubs for you. You can read more about it in the gRPC Swift Protobuf documentation.

Usage

Build and run the server using the CLI:

$ PROTOC_PATH=$(which protoc) swift run hello-world serve
Greeter listening on [ipv4]127.0.0.1:31415

Use the CLI to send a request to the service:

$ PROTOC_PATH=$(which protoc) swift run hello-world greet
Hello, stranger

Send the name of the greetee in the request by specifying a --name:

$ PROTOC_PATH=$(which protoc) swift run hello-world greet --name "PanCakes 🐶"
Hello, PanCakes 🐶