Move proxy to make it an example, update its README.md

This commit is contained in:
Mingwei Samuel 2024-01-20 19:31:54 -08:00
parent 25f41388f0
commit 655d04f8df
5 changed files with 8 additions and 6 deletions

View file

@ -1,5 +1,4 @@
[workspace] [workspace]
members = [ members = [
"riven", "riven",
"example/proxy",
] ]

View file

@ -72,7 +72,7 @@ Output:
``` ```
The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html) The [`RiotApi` struct documentation](https://docs.rs/riven/latest/riven/struct.RiotApi.html)
contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests) contains additional usage information. The [tests](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/tests)
and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/example/proxy) and [example proxy](https://github.com/MingweiSamuel/Riven/tree/v/2.x.x/riven/examples/proxy)
provide more example usage. provide more example usage.
## Feature Flags ## Feature Flags

View file

@ -58,4 +58,7 @@ colored = "2"
env_logger = "0.10.0" env_logger = "0.10.0"
fake_instant = "0.5.0" fake_instant = "0.5.0"
futures = "0.3" futures = "0.3"
tokio = { version = "1", default-features = false, features = [ "rt-multi-thread" ] } hyper = { version = "0.14", features = [ "server" ] }
tokio = { version = "1", features = [ "full" ] }
tracing = "0.1"
tracing-subscriber = "0.2"

View file

@ -14,7 +14,7 @@ when Riven is at the rate limit.
Set `RGAPI_KEY` env var then run: Set `RGAPI_KEY` env var then run:
```bash ```bash
export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
cargo run cargo run --example proxy
``` ```
Test in your browser or using `curl`. The first path segment specifies the region: Test in your browser or using `curl`. The first path segment specifies the region:
@ -25,8 +25,8 @@ $ curl http://localhost:3000/na1/lol/summoner/v4/summoners/by-name/LugnutsK
$ curl http://localhost:3000/eu/val/status/v1/platform-data $ curl http://localhost:3000/eu/val/status/v1/platform-data
{"id": "EU", "name": "Europe", "locales": ["..."], "maintenances": [], "incidents": []} {"id": "EU", "name": "Europe", "locales": ["..."], "maintenances": [], "incidents": []}
$ curl http://localhost:3000/americas/lol/tournament-stub/v4/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}' $ curl http://localhost:3000/americas/lol/tournament-stub/v5/providers -H "Content-Type: application/json" -d '{"region":"JP","url":"https://github.com/MingweiSamuel/Riven"}'
764 1
$ curl http://localhost:3000/na1/unknown/endpoint $ curl http://localhost:3000/na1/unknown/endpoint
{"error":"Riot API endpoint method not found."} {"error":"Riot API endpoint method not found."}