Backend

The backend is built with Hono and provides:

API Endpoints

  • GET / - Serves the main application with server-side data injection
  • GET /api/matches - Returns today's football matches in JSON format
  • GET /frontend/* - Serves frontend static files
  • GET /shared/* - Serves shared utility files

Features

  • Server-side data injection for faster initial load
  • Mock football data (can be replaced with real API)
  • CORS handling (automatic in Val Town)
  • Error handling with full stack traces
  • Static file serving using Val Town utilities

Data Source

Currently uses mock data that simulates real football matches. To integrate with a real API:

  1. Replace the fetchTodaysMatches() function
  2. Use a service like football-data.org, API-Football, or similar
  3. Add environment variables for API keys if needed

Mock Data

The current implementation includes:

  • Live matches with scores and minute updates
  • Scheduled matches with kickoff times
  • Finished matches with final scores
  • Multiple competitions (Premier League, La Liga, etc.)