A gRPC API with grpc gateway and openapi
 
 
 
Go to file
sundowndev e854597382 refactor: add timeout to server closing 2024-02-28 16:18:47 +04:00
bin chore: update gitignore 2024-02-26 14:18:54 +04:00
gen feat: implement health check protocol 2024-02-28 16:03:55 +04:00
proto feat: implement health check protocol 2024-02-28 16:03:55 +04:00
scripts feat: install gateway and openapi deps 2024-02-27 23:21:35 +04:00
server refactor: add timeout to server closing 2024-02-28 16:18:47 +04:00
.gitignore feat: install gateway and openapi deps 2024-02-27 23:21:35 +04:00
LICENSE Initial commit 2024-02-21 17:18:31 +04:00
Makefile feat: implement health check protocol 2024-02-28 16:03:55 +04:00
README.md docs: readme 2024-02-28 16:18:47 +04:00
buf.gen.yaml feat: install gateway and openapi deps 2024-02-27 23:21:35 +04:00
buf.work.yaml initial commit 2024-02-26 14:12:30 +04:00
go.mod chore: run go mod tidy 2024-02-28 16:18:47 +04:00
go.sum chore: run go mod tidy 2024-02-28 16:18:47 +04:00
main.go feat: implement health check protocol 2024-02-28 16:03:55 +04:00

README.md

grpc-api-example

This repository demonstrates how to use gRPC with Go and various plugins. It's a simple API to manage notes. It uses grpc-gateway to handle HTTP requests and openapi to define API specs.

Demonstrated features

  • buf.build framework
  • grpc gateway + openapi specs and swagger UI
  • graceful server shut down (designed for orchestration systems such as k8s)
  • gRPC health check protocol.
  • rpc message validation
  • gRPC services testing

⚠️ For demo purposes, encryption wasn't properly handled in this project.

Installation

This project uses go1.20.

$ make install-tools
$ make build

Run the server

$ ./bin/server -h
Usage of ./bin/server:
  -grpc-server-endpoint string
    	gRPC server endpoint (default "localhost:9090")
  -http-server-endpoint string
    	HTTP server endpoint (default "localhost:8000")