Exercise: Capitalize RPC Unary API
Implement a unary RPC in the text editor system which returns the capitalize text.
Capitalize text RPC
Your goal is to implement a capitalize
RPC Unary API in a TextEditorService
.
The function takes a
Request
message that has a single string.It returns a
Result
that represents the capitalized version of the input string.
Follow these steps:
Define the service in a .proto file: Create the RPC messages and service definition.
Implement the server code: Implement the server logic to handle the request and return the capitalized response.
Test the server code by implementing the client: Ensure the client can send a string and the server responds with the capitalized string.
The client will send the string “hello world” and the server will respond with “HELLO WORLD”.
Good luck!
Step 1: Define the service in a .proto file
The RPC will be defined in a service inside a .proto
file. The steps to create the file are listed below:
Create a
.proto
file namedtext-editor.proto
.The name of the service is
TextEditorService
. It contains an RPC namedcapitalize
which takes aRequest
message and returns aResult
message.The
Request
message has a single string field namedtext
.The
Result
...