Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 825 Bytes

File metadata and controls

45 lines (29 loc) · 825 Bytes

go-rest-api-protobuf-protovalidate-demo

This demo is about to demonstrate how to use protobuf and protovalidate with REST API written in go.

Requirements

To generate the go files for the protobuf definitions you need buf installed.

Usage

Protobuf

To generate the go files to pkg/proto/demo/v1 for the protobuf definitions located under proto/demo/v1 run:

buf generate

Server

Start http server with:

go run cmd/server/main.go

Client

Then request the server with:

curl -XPOST --json '{}' localhost:8080/customer

Routes

The following CRUD routes are available:

GET    localhost:8080/customer
POST   localhost:8080/customer
GET    localhost:8080/customer/{id}
PUT    localhost:8080/customer/{id}
DELETE localhost:8080/customer/{id}