Welcome to the Sports Application API! This API allows you to manage sports data, including points tables, fixtures, and live streams.
To get started with the Sports Application API, follow these steps:
-
Clone the repository to your local machine:
git clone https://github.com/Calladrus2001/Eshway-Task.git cd Back-end_task -
Install the required dependencies using npm:
npm install
-
Configure the MongoDB connection:
- Make sure you have MongoDB installed and running locally or provide a connection string to your MongoDB instance by editing
index.js.
- Make sure you have MongoDB installed and running locally or provide a connection string to your MongoDB instance by editing
-
Start the server:
npm start
-
The server should now be running on the specified port (default: 3000).
For testing purposes, you can use ngrok to expose your local server to the internet. Follow these steps:
-
Install ngrok if you haven't already.
-
Start your server:
npm start
-
In a separate terminal window, run ngrok to create a public URL:
ngrok http 3000
Replace
3000with the port your server is running on if it's different. -
Ngrok will generate a public URL (e.g.,
https://your-ngrok-url.ngrok.io) that you can use for testing and development.
- URL:
/api/points-table - Method: GET
- Description: Get the point-wise ranking for all teams or sports.
- URL:
/api/points-table - Method: POST
- Description: Add a new team to the points table.
- URL:
/api/points-table - Method: PUT
- Description: Update points for a team.
- Request Body:
{ "teamName": "TeamA", "points": 10 }
- URL:
/api/fixtures - Method: GET
- Description: Get a list of sports and their fixtures.
- URL:
/api/fixtures - Method: POST
- Description: Add a new fixture.
- Request Body:
{ "sport": "Football", "date": "2023-09-30", "team": "TeamA" }
- URL:
/api/fixtures - Method: PUT
- Description: Update a fixture.
- Request Body:
{ "fixtureId": "64792eged721ge8910ye", "sport": "Football", "date": "2023-09-30", "team": "TeamB" }
- URL:
/api/live-streams - Method: GET
- Description: Get a list of sports and their live streams.
- URL:
/api/live-streams - Method: POST
- Description: Add a new live stream.
- Request Body:
{ "sport": "Football", "youtubeLink": "https://www.youtube.com/your-live-stream-url" }
- URL:
/api/live-streams - Method: PUT
- Description: Update a live stream.
- Request Body:
{ "liveStreamId": "6473t63791egr7193d3w", "sport": "Football", "youtubeLink": "https://www.youtube.com/updated-live-stream-url" }