Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kevinmichaelchen/buf-vanguard-rest

GraphQL, REST, gRPC, and Connect — all powered from the same underlying Protobuf API — thanks to Buf and Tailcall
https://github.com/kevinmichaelchen/buf-vanguard-rest

bufbuild connectrpc graphql protobuf protocol-buffers rest tailcall

Last synced: about 1 month ago
JSON representation

GraphQL, REST, gRPC, and Connect — all powered from the same underlying Protobuf API — thanks to Buf and Tailcall

Awesome Lists containing this project

README

        

# buf-vanguard-rest

A demo showing how one [Buf][buf] API can offer GraphQL, REST, gRPC, and
[Connect][connect] protocols, using a combination of [Vanguard][vanguard] and [Tailcall][tailcall].

Inspired by this [example][vanguard-example].

[buf]: https://buf.build/
[connect]: https://connectrpc.com/
[tailcall]: https://tailcall.run/
[vanguard]: https://github.com/connectrpc/vanguard-go
[vanguard-example]:
https://github.com/connectrpc/vanguard-go/blob/main/internal/examples/pets/internal/proto/io/swagger/petstore/v2/pets.proto

## Getting Started

### Run the server

Run the server on port 8080 with:

```shell
go run main.go
```

### Make a REST request

```shell
$ http localhost:8080/foos/1

HTTP/1.1 200 OK
Accept-Encoding: gzip
Content-Encoding: gzip
Content-Length: 55
Content-Type: application/json
Date: Sat, 13 Jan 2024 18:28:44 GMT

{
"foo": {
"id": "1",
"name": "Bar"
}
}

```

### Make a Connect request

```shell
curl -v http://localhost:8080/bvr.v1beta1.FooService/CreateFoo \
-H "Content-Type: application/json" \
--data-binary @- <