Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fatih/twirpdemo
An example repository of using the Twirp RPC framework with Go
https://github.com/fatih/twirpdemo
golang rpc twirp
Last synced: 3 months ago
JSON representation
An example repository of using the Twirp RPC framework with Go
- Host: GitHub
- URL: https://github.com/fatih/twirpdemo
- Owner: fatih
- License: mit
- Created: 2021-11-19T09:33:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-19T14:54:55.000Z (about 3 years ago)
- Last Synced: 2024-06-19T01:39:13.397Z (7 months ago)
- Topics: golang, rpc, twirp
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 33
- Watchers: 5
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# twirpdemo
This repo was created for a local meetup to show some of the features of the [Twirp RPC framework](https://twitchtv.github.io/twirp/docs/intro.html).
## Usage
Generate proto code:
```
protoc --twirp_out=. --go_out=. proto/rpc.proto
```Run the calculator service:
```
$ go run cmd/calculatorsvc/main.go
2021/11/19 13:13:43 server started at port 8080
```Make a request using curl:
```
$ curl \
--request "POST" \
--header 'Content-Type:application/json' \
--data '{"a": 10, "b": 5}' \
http://localhost:8080/twirp/Calculator/Add{"result":15}⏎
````Make a request using generated Go client:
```
$ go run cmd/calculatorctl/main.go
Result = 15
````