Mock Service
A Mock gRPC Server
Directory structure
├── cmd # Main applications for this project
| ├── cli # Command Line code directory
| ├── grpc # The entry point of gRPC application (grpc mode)
| ├── main.go # The entry point of web application
├── conf # The configuration directory
├── deployments # The deployment file directory
├── examples # The example for gRPC call
├── grpc # Contains the gRPC client and proto file (grpc mode)
├── internal # Private application and library code
| ├── domain # Business logic code directory
| ├── webapi # WebAPI code directory (webapi mode)
| ├── grpc # gRPC Stub implementation code directory (grpc mode)
├── schema # The database schema directory
├── test # The web api integration test code directory
├── .air.toml # Live loading config file
├── .gitignore # Git ignore file
├── CHANGELOG # Change log
├── docker-entrypoint.sh # The entry point shell script for the application running in container
├── Dockerfile # Docker build file
├── go.mod # Golang module package dependencies file
├── go.sum # Golang module package dependencies sum file
├── LICENSE # License file
├── Makefile # Make file
└── README.md # The top level README for developers using this project
Live-reloading
go install github.com/cosmtrek/air@latest
Protocol Buffer Compiler Installation
brew install protobuf
Go plugins for the protocol compiler Installation
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
Generate gRPC code
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative *.proto
Deployments
Kubectl Config
kubectl config get-contexts
kubectl config use-context <CONTEXT_NAME>
kubectl config set-context --current --namespace=<dev|prod|staging>
Scripts of Development
make help # Print help
make test # Unit test
make run # Runs the app in development mode on local
make live # Live reloading
make compile # Compile TypesScript to JavaScript
Dependencies