This project will be continued under a different repository https://github.com/CowsWasTaken/nest-league-playtime-api
Unless this lets you see your total playtime (also with a filter for game modes) and a list of all matches played
Clone the project
git clone https://github.com/CowsWasTaken/league-playtime-api.gitGo to the project directory (don't forget to set your API_KEY in the .env file)
cd league-playtime-apiRun Database
docker compose upInstall dependencies
npm installStart the server
npm run start:devYou can access the service on http://localhost:port/ (default is set to 4000)
To get an API_KEY visit https://developer.riotgames.com/ , create an account and generate an API_KEY
Make sure to have Docker and Docker Compose installed at your machine.
The latest version of mysql image is used for the database.
The Database schema can be seen in the schema.sql. As Query Builder is Knex.js used, so its relative versatile
To run this project, you will need to add the following environment variables to your .env file
Example:
NODE_ENV='development'
SERVICE_PORT=4000
DATABASE_HOST='127.0.0.1'
DATABASE_USER='root'
DATABASE_PASSWORD='password'
DATABASE_DATABASE='league_db'
DATABASE_PORT=3306
API_KEY='RGAPI-xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx'What optimizations did you make in your code? E.g. refactors, performance improvements, accessibility
GET /:platformValue/matches/:summonername?gameMode=ARAM| Parameter | Type | Description | Model |
|---|---|---|---|
:platformValue |
pathParam |
Required | https://developer.riotgames.com/docs/lol#_routing-values |
:summonername |
pathParam |
Required | |
gameMode |
queryParam |
Optional | https://static.developer.riotgames.com/docs/lol/gameModes.json |
Returns played matches and playtime in seconds
{
"gameMode": {
"gameMode": "ARAM",
"description": "ARAM games"
},
"matchesCount": 866,
"playtime": 1018842
} GET /:platformValue/matches/:summonername/detailed| Parameter | Type | Description | Model |
|---|---|---|---|
:platformValue |
pathParam |
Required | https://developer.riotgames.com/docs/lol#_routing-values |
:summonername |
pathParam |
Required |
[
{
"matchId": "EUW1_5775938866",
"gameDuration": 986,
"gameCreation": 1647198074000,
"gameEndTimestamp": 1647199186077,
"gameId": 5775938866,
"gameName": "teambuilder-match-5775938866",
"gameType": "MATCHED_GAME",
"gameMode": "ARAM",
"mapId": 12
},
{
"matchId": "EUW1_5776061973",
"gameDuration": 1418,
"gameCreation": 1647199393000,
"gameEndTimestamp": 1647200912668,
"gameId": 5776061973,
"gameName": "teambuilder-match-5776061973",
"gameType": "MATCHED_GAME",
"gameMode": "ARAM",
"mapId": 12
},
...
]Fetch and store all Matches related to summoner in database.
Not yet optimized for fetching Summoner Matches at the same time,
because the Rate Limit from the League API_KEY is quickly reached
for Development Keys
POST /:platformValue/matches/:summonername/execute| Parameter | Type | Description | Model |
|---|---|---|---|
:platformValue |
pathParam |
Required | https://developer.riotgames.com/docs/lol#_routing-values |
:summonername |
pathParam |
Required |
- @CowsWasTaken (send me your bitcoin ) jkjk unless ...