...

/

Exercise: Capitalize RPC Unary API

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:

  1. Define the service in a .proto file: Create the RPC messages and service definition.

  2. Implement the server code: Implement the server logic to handle the request and return the capitalized response.

  3. 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:

  1. Create a .proto file named text-editor.proto.

  2. The name of the service is TextEditorService. It contains an RPC named capitalize which takes a Request message and returns a Result message.

  3. The Request message has a single string field named text.

  4. The Result ...