A toolbox of common go components.
Install modules: $ go mod init
REST API with Protobuf requests and responses
- Client:
- /: Sends JSON payload via POST request, converts payload to Protobuf and sends to Server.
- Server receives the Protobuf payload, and sends it back in the response.
- Server:
- /: POST requests receives a Protobuf payload and sends it back encoded in Protobuf.
- /: GET request returns a DummyResponse object over Protobuf.
- /page: Both GET and POST requests return a paged response ProtoResponsePage
- Add "?json=true" to get a JSON response instead of a Protobuf response
- /complex: Sends a POST request via Protobuf and receives a paged response via Protobuf
$ go run rest-ptbuf/cmd/client/main.go
Run from module root: $ protoc --go_out=. proto/facto.proto
Add new modules to the workspace: $ go work use