This application uses gRPC
and proto
to send user data to a database (mongoDB).
This uses CRUD functions.
This service also has a Publish/subscribe method using dapr, a new patient is created in the publish method, which is sent to mongoDB, then the callback function subscribe
method takes that data and adds that user to auth0 where they can then login to view their information.
- Install/update dependencies
go get -u
- Initiate gRPC:
protoc --proto_path=proto patient/v1/patient.proto --go_out=. --go-grpc_out=.
This is the standard way of generating gRPC, however with this app I am using a makefile configured with dapr to manage my commands. So instead runmake proto
, this will also send the proto definitions tohttps://buf.build
as a commit. - Run the application
go run .
ormake run
Install and configure the dapr CLI:
brew install dapr/tap/dapr-cli
dapr init
Add Buf API key to .netrc
file
machine buf.build password <your Buf API key>
machine go.buf.build login <your Buf username> password <your Buf API key>
- To make a build on
docker
rundocker build --tag patient .
- To run on docker
docker run -d -p 8080:8080 patient