Changes
- Restructured repo by creating the following folders
- Monolith (Containing the first version of the software)
- Microservice (Containing the api specification of the api version of the software)
- Proto (Containing the gRPC version of the software)
- Created a gRPC version in the proto folder
Implementation details
(These implementation details will be assuming proto/ as the working directory)
The gRPC version of the software is created by first defining the endpoint details in the course/course.proto file using the gRPC IDL. Then using the gen.sh script we generate some server and client boilerplate. The boilerplate is then expanded upon in the server/main.go file. This file contains an implementation that mirrors the implementation of the course endpoint in the monolith version, by creating a struct that contains a course repository and an UniplementedCourseServiceServer which is then used to register the endpoints and is finally registered in the main() method.
The client/main.go file does exactly the same thing as the HTTP version did using the gRPC this time, by instantiating the NewCourseServiceClient boilerplate and simply calling the respective routines, instead of using REST calls.
Every other implementation detail is the same as in the monolith version.