This codebase hosts a client and server gRPC service showcasing buf.build as well as using packages which are hosting your proto files and generated code.
This repo using proto-store package in both it's go and javascript example.
The servers all connect to a mongo db which you can connect your own by setting in an .env file at all entry levels within the go/js server folders.
The model in the db collection used in the example can be seen here or below
const movieSchema = new Schema({
title: {
type: String,
required: true,
},
year: {
type: Number,
required: true,
},
director: {
type: String,
required: true,
},
});
The endpoints in both languages provide examples of
Port: :8080
Method type | Endpoint | Params/Body |
---|---|---|
GET | / | Params: page, per_page |
GET | /:id | N/A |
POST | / | Body: title, director, year |
The client for the go example uses Gin
The Javascript using typescript as for the client server it's running an express server
From the root director you can run the commands inside of the Makefile
e.g running javascript client and service
make js-server
make js-client
e.g running go client and service
make go-run-grpc
make go-run-gin