gRPC blog service from gRPC Master Class: Build Modern API & Microservices on Udemy
Install the protobuf compiler plugins for Go using the following commands:
$ go get google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
Update PATH so that the protoc compiler can find the plugins:
$ export PATH="$PATH:$(go env GOPATH)/bin"
$ protoc --go_out=. --go-grpc_out=. blogpb/blog.proto
Download MongoDB from https://www.mongodb.com/try/download/community and install it. On Debian Linux, run the following commands to start mongod
:
# systemctl enable mongod
# systemctl start mongod
# systemctl status mongod
The last command should show that mongod
was started successfully.
Robo 3T is a GUI for MongoDB. Install the latest release from GitHub releases.
Robo 3T can be used to inspect the blog database:
To connect to MongoDB the blog serivce uses the mongodb-go-driver
To add the dependency, do
$ go get go.mongodb.org/mongo-driver/mongo