https://damp-stream-51136.herokuapp.com/
npm install
Create in root folder a file: variables.js and write:
exports.API_KEY="YOUR_KEY_TO_FOOTBALL_API"
exports.TOKEN_SECRET = "YOUR_SECRET_TEXT"
npm start
POST /api/lobbies
Body Schema:
{"name": "name_of_lobby"}
GET /api/lobbies
Expected response:
[
{
"users": [...],
"_id" : ...,
"name": ...,
"createdDate": ...
},
...
]
DELETE /api/lobbies/:lobbyID
PUT /api/lobbies/:lobbyID/add
Body Schema:
{"email": "email_of_user"}
GET api/lobbies/:lobbyID/users
Expected response:
[
{
"_id" : ...,
"name": ...,
"email": ...
},
...
]
GET api/lobbies/:lobbyID/:fixtureID/check
Expected response:
"Match has not started yet!"
or
[
{
"name": ...,
"message": "Correct! You got 3 points!" || "Not this time" || "User didn't bet for this fixture",
"score": ...
},
...
]
POST api/users
Body Schema:
{
"name": "name_of_user", // Minimum 2 characters
"email" : "email", // Minimum 5 characters
"password" : " " // Minimum 5 characters
}
POST api/users/login
Body Schema:
{
"email" : "email",
"password" : " "
}
x-auth-token - required
PUT api/users/bets/
Body Schema:
{
"fixtureID": "...",
"bet" : "String", // for example "2-1"
"lobbyID" : "..."
}
It will either add or update bet for indicated lobby.
POST api/fixtures/
Body Schema:
{
"league": "string", // for example : "Premier League"
"date" : "YYYY-MM-DD"
}
Expected response:
"There are no matches for entered day!|
or
[
{
"_id": "5e0169919e980c21e09566c7",
"league_name": "Premier League",
"fixture_id": 157203,
"homeTeamName": "Tottenham",
"awayTeamName": "Brighton",
"score": null,
"date": "2019-12-26T12:30:00+00:00",
"status": "Not Started",
},
...
]
PUT api/fixtures/:fixtureID
Expected response:
"Match finished. No need to update."
or
"Match has not started!"
or
{
"homeTeamName": "...",
"awayTeamName": "...",
"score": "..."
}
GET api/fixtures/:fixtureID
Expected response:
"There is no fixture in database with typed ID"
or
{
"homeTeamName": "...",
"awayTeamName": "...",
"score": "...",
"status": "..."
}
GET api/users/me
Expected response:
{
"email" : "email",
"password" : " ",
"usersBets" : [...]
}