Skip to content
Open
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
214 changes: 123 additions & 91 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,119 +1,151 @@
🎵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.
# 🎵 Music Tracker API

📁 Project Structure
📦 Music Tracker API
├── controllers/
A simple yet powerful RESTful API built with **Node.js** and **SQLite** that lets users manage a list of songs. It supports adding, retrieving, and storing songs locally, with an optional frontend for browser-based interaction.

## 📁 Project Structure

```
MusicTrackerAPI/
├── controllers/ # Contains logic to handle API requests
│ └── songController.js
├── routes/
├── routes/ # Defines API endpoints and routing
│ └── 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
1. 📥 Clone the Repository
bash
git clone https://github.com/your-username/music-tracker-api.git
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
├── music.db # SQLite database file
├── db.js # Database connection and setup
├── server.js # Main server file to run the API
├── MusicAPI.html # Optional HTML frontend for testing API
└── README.md # Project documentation
```
## 🚀 Features

{
"id": 1,
"title": "Test Song",
"artist": "Tester",
"genre": "Rock"
}
- 🎧 Add and retrieve songs using REST APIs
- 🗃️ Local database using **SQLite**
- 📊 Easy integration with **DB Browser for SQLite**
- 🌐 Optional HTML frontend to view/add songs via a form
- 🔒 Fully local — no external APIs or cloud services

## ⚙️ Getting Started

### 1. Clone the Repository

```bash
git clone https://github.com/Ananya-te/MusicTrackerAPI.git
cd MusicTrackerAPI
```

###2. Install Dependencies

Ensure you have Node.js installed, then run:
```bash

npm install
```

###3. Start the Server
```bash

node server.js

The server will start at: http://localhost:5000
```


## 🔌 API Endpoints

📥 Add a Song
```bash

POST /api/songs
Adds a new song to the database.
```

Request Body:
json
```bash
Json

{
"title": "Shape of You",
"artist": "Ed Sheeran",
"genre": "Pop"
}
```

Response:
📤 Get All Songs
```bash
GET /api/songs
```

## Response:
```bash
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)
[
{
"id": 1,
"title": "Shape of You",
"artist": "Ed Sheeran",
"genre": "Pop"
}
]
```


## 🧪 Database Schema
```bash
SQL

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

Managed with: db.js

Uses local file: music.db

Tables are created automatically on server start


## 🌐 Optional Frontend Usage

Open MusicAPI.html in your browser to:

1. View all songs in a list

2. Add songs via a simple form

Make sure your server is running before using the frontend.


## 🛠️ Tech Stack

> Node.js

> Express.js

> SQLite3

> HTML, CSS, JavaScript for UI


## 🤝 Contributing

We welcome contributions! 💛

1. Fork this repo

2. Create a new branch: feature/your-feature-name

3. Make your changes and commit

4. Open a Pull Request with a meaningful description

🌐 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!
## License

This project is open-source and free to use, modify, or improve.
Let's build something awesome! 🚀



Expand Down