Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Danielsl4/TFG_DAM_2526_Consulta2/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through the five steps you need to go from zero to actively using Futsal League Manager via the REST API. All endpoints are served by the Node.js/Express backend on port 3000. Replace http://localhost:3000 with your deployment URL if you are running against a hosted environment.
You must verify your email address within 24 hours of registering. Unverified accounts are deleted automatically by a scheduled job. You cannot log in until verification is complete.
1

Register an account

Send a POST /register request with a unique username, a valid email address, and a password. All three fields are required.
curl -X POST http://localhost:3000/register \
  -H "Content-Type: application/json" \
  -d '{"username": "elena", "email": "[email protected]", "password": "MySecurePass1"}'
A successful registration returns HTTP 201 and sends a verification email to the address you provided.
{
  "message": "Registro exitoso. Por favor, revisa tu correo para verificar tu cuenta.",
  "user": {
    "id": 42,
    "username": "elena",
    "email": "[email protected]",
    "role": "user"
  }
}
Open the email and click the verification link. The link calls GET /verify-email/:token on the backend, marks your account as verified, and returns a JWT token for automatic login. You can also proceed to step 2 and log in manually after clicking the link.
2

Log in and obtain a JWT token

Once your email is verified, send a POST /login request with your username (or email) and password.
curl -X POST http://localhost:3000/login \
  -H "Content-Type: application/json" \
  -d '{"username": "elena", "password": "MySecurePass1"}'
The response contains a signed JWT token.
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NDIsInVzZXJuYW1lIjoiZWxlbmEiLCJyb2xlIjoidXNlciIsImlhdCI6MTc0NzM5MjAwMCwiZXhwIjoxNzQ3OTk2ODAwfQ.example_signature"
}
Save this token. You will include it as a bearer token in every authenticated request.
Pass your token in the Authorization header as Authorization: Bearer <token>. Most HTTP clients have a dedicated field for bearer tokens so you do not need to construct the header manually. Regular user tokens are valid for 7 days; admin and referee tokens expire after 6 hours.
3

Browse matches

The match list endpoint is public — no token required. You can filter by season, group, status, or phase using query parameters.
curl http://localhost:3000/matches
The response returns an array of match objects. Each match includes the teams, date, field, phase, status (pendiente, en_curso, or finalizado), and the current score.
[
  {
    "id": 7,
    "date": "2026-05-20T18:00:00",
    "homeTeam": { "id": 3, "name": "Tigres FC", "logoUrl": "https://res.cloudinary.com/..." },
    "awayTeam": { "id": 5, "name": "Halcones", "logoUrl": "https://res.cloudinary.com/..." },
    "field": { "id": 1, "name": "Pabellón Municipal Norte", "location": "Calle Mayor 10" },
    "phase": "fase_de_grupos",
    "status": "pendiente",
    "homeGoals": 0,
    "awayGoals": 0,
    "votingStats": { "local": 0, "draw": 0, "away": 0, "total": 0 },
    "userVote": null
  }
]
To view the full detail for a single match — including match events, vote distribution, and player stats — call GET /matches/:id with the match ID.
curl http://localhost:3000/matches/7
4

Vote on a match outcome

Authenticated users can predict the result of any upcoming match. Send a POST /matches/:id/vote with one of three vote values: local (home win), empate (draw), or visitante (away win).
curl -X POST http://localhost:3000/matches/7/vote \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <your_token>" \
  -d '{"vote": "local"}'
Each user can cast one vote per match. A successful vote returns HTTP 200.
{
  "message": "Voto registrado correctamente",
  "votingStats": { "local": 10, "draw": 3, "away": 5, "total": 18 }
}
Your vote earns you points if the prediction is correct. Track your score and ranking via GET /statistics/user-ranking or your personal stats at GET /statistics/user-stats (requires a token).
5

Check the standings

The standings endpoint is public and returns the current league table, sorted by points. You can pass a season_id or group_id query parameter to filter the results.
curl http://localhost:3000/standings
Each entry in the response shows a team’s full record for the selected season and group.
[
  {
    "team_id": 3,
    "team_name": "Tigres FC",
    "played": 6,
    "won": 4,
    "drawn": 1,
    "lost": 1,
    "goals_for": 22,
    "goals_against": 11,
    "points": 13,
    "yellow_cards": 3,
    "red_cards": 0
  }
]
The table updates automatically each time a referee finalises a match result.

Build docs developers (and LLMs) love