This project implements an API for a Cricbuzz-like platform using Node.js and MySQL. It allows guest users to browse matches and view details, while admins can manage matches, teams, players, and statistics.
screen-capture.webm
Before getting started, ensure you have the following prerequisites installed:
- Node.js and npm (or yarn)
- MySQL server
git clone https://github.com/Devang2304/Cricbuzz_Platform.git
Navigate to the project directory:
cd Cricbuzz_Platform
Install dependencies:
npm install
- Create a MySQL database named
cricbuzz
(or your preferred name). - Create a file named
.env
in the project's root directory to store database credentials:
DB_HOST=localhost
DB_USER=your_username
DB_PASSWORD=your_password
DB_NAME=cricbuzz
Admins need to register and log in to access admin endpoints. A successful login returns an authorization token required for subsequent admin API calls.
- GET /api/matches: Retrieve a list of upcoming and past matches.
- GET /api/matches/{match_id}: Get details of a specific match, including teams, squads (dummy data for now), and (to be implemented) match status and commentary.
- POST /api/admin/signup: Register a new admin user.
- POST /api/admin/login: Login an admin user and get an authorization token.
- POST /api/matches: Create a new match.
- POST /api/teams/{team_id}/squad: Add a player to a team's squad.
- GET /api/players/{player_id}/stats: Get statistics for a player (dummy data for now).
- Start the MySQL server if not already running.
- Open a terminal in the project directory (
Cricbuzz_Platform
). - Start the API server:
nodemon app.js
Please refer to the code for detailed implementation and API interactions.