Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 109 additions & 85 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,149 @@
🎡Music Tracker API
A simple Node.js + SQLite3 project to manage a list of songs using RESTful APIs. Optionally includes a basic frontend to interact with the API.

πŸ“ Project Structure
πŸ“¦ Music Tracker API
β”œβ”€β”€ controllers/
β”‚ └── songController.js
β”œβ”€β”€ routes/
β”‚ └── songRoutes.js
β”œβ”€β”€ db.js
β”œβ”€β”€ music.db
β”œβ”€β”€ server.js
β”œβ”€β”€ MusicAPI.html (optional frontend)
└── README.md

πŸ“Œ Features
βœ… Create, Read songs using API
βœ… Local database using SQLite
βœ… Integrated with DB Browser for SQLite
βœ… HTML frontend (optional)
βœ… Fully local setup β€” no external APIs used

πŸš€ How to Run This Project
## 🎡Music Tracker API

A local RESTful API which is made by using Node.js, Express.js and SQLite3 that allows users to manage a list of songs and playlists. We can perform tasks like creating,viewing and playing a song, as well as creating, viewing and running a playlist. Optionally includes a basic frontend to interact with the API.

## πŸ“ Project Structure

πŸ“ MusicTrackerAPI
β”œβ”€β”€ _tests/
β”‚ β”œβ”€β”€ api/
β”‚ β”œβ”€β”€ integration/
β”‚ └── unit/
β”œβ”€β”€ controllers/
β”‚ └── songController.js
β”œβ”€β”€ routes/
β”‚ └── songRoutes.js
β”œβ”€β”€ music.db
β”œβ”€β”€ db.js
β”œβ”€β”€ server.js
β”œβ”€β”€ MusicAPI.html
β”œβ”€β”€ package.json
β”œβ”€β”€ coverage/
β”œβ”€β”€ .github/workflows/
β”œβ”€β”€ appss.png
β”œβ”€β”€ appss2.png
└── README.md

## πŸ“Œ Features

βœ… Create, view and play songs and playlists using API <br>
βœ… Local database using SQLite3 <br>
βœ… Integrated with DB Browser for SQLite3 <br>
βœ… HTML frontend (optional) <br>
βœ… Backend using Node.js and Express.js <br>
βœ… Fully local setup β€” no external APIs used <br>

## πŸš€ How to Run This Project

1. πŸ“₯ Clone the Repository
bash
git clone https://github.com/your-username/music-tracker-api.git
cd music-tracker-api
`git clone https://github.com/your-username/music-tracker-api.git` <br>
`cd music-tracker-api`

2. πŸ“¦ Install Dependencies
Make sure you have Node.js installed, then:
bash
npm install

3. βœ… Start the Server
bash
node server.js
The server will start at:
http://localhost:5000

🧠 API Endpoints
GET /api/songs
Returns all songs in the database.
Response:
json
Node.js (v14 or above) <br>
β†’ Required to run the backend server. <br>
npm (Node Package Manager) <br>
`npm install` <br>
β†’ Comes with Node.js. Used to install project dependencies. <br>

3. βœ… Start the Server <br>
Run this command : <br>
`node server.js` <br>
The server will start at: <br>
http://localhost:5000 <br>

## 🧠 API Endpoints

GET /api/songs <br>
Returns all songs in the database. <br>
Response:
```json

{
"id": 1,
"title": "Test Song",
"artist": "Tester",
"genre": "Rock"
}
```


POST /api/songs
Adds a new song to the database.
Request Body:
json
POST /api/songs <br>
Adds a new song to the database. <br>
Request Body:
```json
{
"title": "Shape of You",
"artist": "Ed Sheeran",
"genre": "Pop"
}
```

Response:
json
```json
{
"id": 2,
"title": "Shape of You",
"artist": "Ed Sheeran",
"genre": "Pop"
}
```

πŸ—ƒοΈ Database Used
πŸ“Œ SQLite Database File: music.db
πŸŽ›οΈ Managed Using: DB Browser for SQLite
πŸ› οΈ Tables are auto-created on server start (via db.js)
## πŸ—ƒοΈ Database Used

🎼 Table Schema:
sql
πŸ“Œ SQLite Database File: music.db <br>
πŸŽ›οΈ Managed Using: DB Browser for SQLite <br>
πŸ› οΈ Tables are auto-created on server start (via db.js) <br>

## 🎼 Table Schema:

```sql
CREATE TABLE IF NOT EXISTS songs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT,
artist TEXT,
genre TEXT
);
```

🌐 Frontend
You can open the MusicAPI.html file directly in your browser:
πŸ”— Features:
1.Add a song using a form
2.View all songs in a list
To use:
1.Make sure the server is running.
2.Double-click MusicAPI.html to open it in your browser.
3.Fill in the form and click β€œAdd Song”.

πŸ“¬ Sample curl Requests
Add a Song:
bash
curl -X POST http://localhost:5000/api/songs \
-H "Content-Type: application/json" \
-d "{\"title\":\"Test Song\", \"artist\":\"Tester\", \"genre\":\"Rock\"}"

Get All Songs:
bash
curl http://localhost:5000/api/songs

πŸ›  Built With
1.Node.js
2.Express.js
3.SQLite3
4.[HTML/CSS/JS] for frontend

πŸ“„ License
This project is open-source and free to use. Feel free to fork and modify for learning or improvement!



## 🌐 Frontend

You can easily run the frontend by opening the MusicAPI.html file in your browser. <br>
πŸ”§ Features: <br>
🎡 Add a song using a simple form <br>
πŸ“‹ View all added songs in a list <br>

## πŸš€ How to Use:

Make sure your server is running (node server.js) <br>
Double-click on MusicAPI.html to open it in your browser <br>
Fill out the form and hit β€œAdd Song” to submit 🎢 <br>

## Sample curl Requests
* 🎡 Add a New Song
```bash
Copy
Edit
curl -X POST http://localhost:5000/api/songs \
-H "Content-Type: application/json" \
-d '{
"title": "Test Song",
"artist": "Tester",
"genre": "Rock"
}'
```
* Get All Songs:
```bash
curl http://localhost:5000/api/songs
```
## πŸ› οΈ Built With <br>

- 🟩 **Node.js** – For backend JavaScript runtime <br>
- πŸš‚ **Express.js** – Web framework to handle routes and APIs <br>
- πŸ—ƒ **SQLite3** – Lightweight database for storage <br>
- 🌐 **HTML/CSS/JavaScript** – To power the frontend UI <br>

## πŸ“„ License <br>

This project is **open-source** and free to use! <br>
Feel free to **fork it**, **play around**, or even use it to build something cooler. <br>
Just don’t forget to give credit if you’re vibing with it πŸ’«
Loading