Skip to content

CRUD example to learn how gRPC works in Go with MongoDB

License

Notifications You must be signed in to change notification settings

salprima/gocrud-grpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go CRUD gRPC

CRUD example to learn how gRPC works in Go with MongoDB

Prerequisite

How to run gRPC server

  1. clone this repository git clone [email protected]:salprima/gocrud-grpc.git
  2. execute go mod tidy to add missing and remove unused modules dependencies
  3. adjust configs/default-config.yml according to your local environment
  4. start gRPC server by executing make run-grpc-server
  5. if everything okay, you will see something like the following in your terminal
$ make run-grpc-server
go run cmd/grpc-server/main.go
2020/05/25 19:13:26 loading config file default-config.yml 
2020/05/25 19:13:26 Starting up GRPC server...
2020/05/25 19:13:26 Creating connection to database...
2020/05/25 19:13:26 Connected to database...

How to run gRPC client

  1. follow steps 1-3 on How to run gRPC server above
  2. make sure gRPC server up and running
  3. run gRPC client by executing make run-grpc-client
  4. if all good, you will see log in your terminal simulating all gRPC methods as describe in api/protobuf/user.proto

What to expect?

  • understand how gRPC client & server implementation in Go
  • know how MongoDB works within Go using MongoDB Go Driver
  • a little example of how Viper works to deal with configuration file
  • TIPS: you can run gRPC client using another language you loved, see available quick start guide here

License

This project is licensed under the MIT License, see the LICENSE file for details.

About

CRUD example to learn how gRPC works in Go with MongoDB

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published