- Configured database on MLab and provided the env variable
- Configure
DB_URL
,TOKEN_SECRET
,PORT
env variables on heroku
Steps to generate JWT token
-
URL -
https://battle-royal-api.herokuapp.com/user/
(POST) -
Payload
email:satish.jhanwer@gmail.com password:Satish@123 name:Satish Jhanwer
-
Returns
{ "message": "User added successfully!!!" }
-
URL -
https://battle-royal-api.herokuapp.com/user/login
(POST) -
Payload
email:satish.jhanwer@gmail.com password:Satish@123
-
Returns
{ "token": <token value> }
Use token which is generated from previous step for further api calls
-
URL -
https://battle-royal-api.herokuapp.com/api/list
(GET) -
Header
x-access-token: <token value>
-
Returns list of distinct battle locations
-
URL -
https://battle-royal-api.herokuapp.com/api/count
(GET) -
Header
x-access-token: <token value>
-
Returns total no. of battles.
-
URL -
https://battle-royal-api.herokuapp.com/api/search
(GET) -
Header
x-access-token: <token value>
-
Eg:
/api/search?king=Robb Stark&location=Golden Tooth&battle_type=pitched battle
-
URL -
https://battle-royal-api.herokuapp.com/api/stats
(GET) -
Header
x-access-token: <token value>
-
Returns Battle stats.
-
Response
{ "most_active": { "attacker_king": "Joffrey/Tommen Baratheon", "defender_king": "Robb Stark", "region": "The Riverlands", "name": "Siege of Winterfell" }, "attacker_outcome": { "win": 32, "loss": 5 }, "defender_size": { "min": 100, "max": 20000, "avg": 6428.1578947368425 }, "battle_type": [ "", "siege", "ambush", "pitched battle" ] }