Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s1ntaxe770r/donut-rpc
Donuts served over grpc
https://github.com/s1ntaxe770r/donut-rpc
golang grpc sqlite
Last synced: 8 days ago
JSON representation
Donuts served over grpc
- Host: GitHub
- URL: https://github.com/s1ntaxe770r/donut-rpc
- Owner: s1ntaxe770r
- Created: 2021-05-31T14:48:30.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-24T20:02:11.000Z (about 3 years ago)
- Last Synced: 2024-06-21T19:05:38.427Z (5 months ago)
- Topics: golang, grpc, sqlite
- Language: Go
- Homepage:
- Size: 75.2 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Donut RPC
![donut](./pixel-donut.webp)a fake donut store built using [grpc](https://grpc.io) and sqlite
## Setup
pull the docker container
```shell
docker pull ghcr.io/s1ntaxe770r/donut-store:latest
```
start the service
```shell
docker run -p 5050:5050 9052:9052 -d donut-store:latest
```## Testing
to test the service install [grpcurl](https://github.com/fullstorydev/grpcurl)
```shell
go install github.com/fullstorydev/grpcurl/cmd/grpcurl
```## List the methods
```shell
grpcurl -plaintext localhost:5050 DonutShop
```
sample response
```shell
DonutShop.GetDonut
DonutShop.GetDonuts
DonutShop.GetVersion
DonutShop.MakeDonut
```### Method (DonutShop.GetDonuts)
```shell
grpcurl -plaintext localhost:5050 DonutShop/GetDonuts
```sample response
```json
{
"donuts": [
{
"name": "bagel",
"price": 32,
"image": "https://none.com/bagel",
"id": "1"
},
{
"name": "glazed donut",
"price": 32,
"image": "https://none.com/bagel",
"id": "3"
},
]
}
```
### Method (DonutShop.GetDonut)
```shell
grpcurl -d '{"name":"bagel"}' -plaintext localhost:5050 DonutShop/GetDonut
```sample response
```json
{
"name": "bagel",
"price": 32,
"image": "https://none.com/bagel",
"id": "1"
}
```
### Method (DonutShop.GetVersion)
```shell
grpcurl -d '{}' -plaintext localhost:5050 DonutShop/GetVersion
```sample response
```json
{
"number": "v0.1"
}
```
### Method (DonutShop.MakeDonut)
```shell
grpcurl -d '{"name":"bagel","price":32,"image":"https://none.com/bagel","id":"001"}' -plaintext localhost:5050 DonutShop/MakeDonut
``````json
{
"name": "bagel"
}
```## Accessing metrics
```shell
curl http://localhost:9092/metrics
```