forked from mirror/Riven
1
0
Fork 0
Riven/example/proxy
Mingwei Samuel 74eb5fa045 Update example proxy for v2, use workspaces.
- `example/proxy` is new folder for `example_proxy`.
- `riven` is new folder for the main riven lib.
- Updated metadata to be an array and include HTTP method.
2021-09-09 14:31:39 -07:00
..
src Update example proxy for v2, use workspaces. 2021-09-09 14:31:39 -07:00
Cargo.toml Update example proxy for v2, use workspaces. 2021-09-09 14:31:39 -07:00
README.md Update example proxy for v2, use workspaces. 2021-09-09 14:31:39 -07:00

README.md

Riven Example Proxy

This is a simple example implementation of a Riot API proxy server using hyper. This adds the API key and forwards requests to the Riot API, then returns and forwards responses back to the requester. It handles error cases but only provides minimal failure information. HTTP requests will wait to complete when Riven is waiting on rate limits.

Set RGAPI_KEY env var then run:

export RGAPI_KEY=RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
cargo run

Test in your browser or using curl. The first path segment specifies the region:

$ curl http://localhost:3000/na1/lol/summoner/v4/summoners/by-name/LugnutsK
{"id":"...","accountId":"...","puuid":"...","name":"LugnutsK","profileIconId":4540,"revisionDate":1589704662000,"summonerLevel":111}

$ curl http://localhost:3000/eu/val/status/v1/platform-data
{"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"}'
764

$ curl http://localhost:3000/na1/unknown/endpoint
{"error":"Riot API endpoint method not found."}