Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kevinmichaelchen/buf-vanguard-rest
- Owner: kevinmichaelchen
- Created: 2024-01-13T17:08:15.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-13T19:04:36.000Z (11 months ago)
- Last Synced: 2024-06-19T18:13:30.136Z (6 months ago)
- Topics: bufbuild, connectrpc, graphql, protobuf, protocol-buffers, rest, tailcall
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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/1HTTP/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 @- <