Skip to content

Instantly share code, notes, and snippets.

@amsokol
Last active September 15, 2018 05:27
Show Gist options
  • Save amsokol/bce8ddf48b834bd1d4689dc8b9ceb45c to your computer and use it in GitHub Desktop.
Save amsokol/bce8ddf48b834bd1d4689dc8b9ceb45c to your computer and use it in GitHub Desktop.
How to develop Go gRPC microservice with HTTP/REST endpoint, middleware, Kubernetes deployment, etc.
syntax = "proto3";
package v1;
import "google/protobuf/timestamp.proto";
// Taks we have to do
message ToDo {
// Unique integer identifier of the todo task
int64 id = 1;
// Title of the task
string title = 2;
// Detail description of the todo task
string description = 3;
// Date and time to remind the todo task
google.protobuf.Timestamp reminder = 4;
}
// Request data to create new todo task
message CreateRequest{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// Task entity to add
ToDo toDo = 2;
}
// Response that contains data for created todo task
message CreateResponse{
// API versioning: it is my best practice to specify version explicitly
string api = 1;
// ID of created task
int64 id = 2;
}
// Service to manage list of todo tasks
service ToDoService {
// Create new todo task
rpc Create(CreateRequest) returns (CreateResponse);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment