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 ├── controllers/ │ └── songController.js ├── routes/ │ └── songRoutes.js ├── db.js ├── music.db ├── server.js ├── MusicAPI.html (optional frontend) └── README.md - ✅ 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
git clone https://github.com/your-username/music-tracker-api.git cd music-tracker-apiMake sure you have Node.js installed, then:
npm installnode server.jsThe server will start at: http://localhost:5000
Returns all songs in the database.
Response:
[ { "id": 1, "title": "Test Song", "artist": "Tester", "genre": "Rock" } ]Adds a new song to the database.
Request Body:
{ "title": "Shape of You", "artist": "Ed Sheeran", "genre": "Pop" }Response:
{ "id": 2, "title": "Shape of You", "artist": "Ed Sheeran", "genre": "Pop" }- 📌 SQLite Database File:
music.db - 🎛️ Managed Using: DB Browser for SQLite
- 🛠️ Tables are auto-created on server start (via
db.js)
CREATE TABLE IF NOT EXISTS songs ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, artist TEXT, genre TEXT );You can open the MusicAPI.html file directly in your browser.
- Add a song using a form
- View all songs in a list
- Make sure the server is running
- Double-click
MusicAPI.htmlto open it in your browser - Fill in the form and click "Add Song"
curl -X POST http://localhost:5000/api/songs \ -H "Content-Type: application/json" \ -d "{\"title\":\"Test Song\", \"artist\":\"Tester\", \"genre\":\"Rock\"}"curl http://localhost:5000/api/songs- Node.js - JavaScript runtime
- Express.js - Web framework
- SQLite3 - Database
- HTML/CSS/JS - Frontend
This project is open-source and free to use. Feel free to fork and modify for learning or improvement!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you have any questions or issues, please open an issue on GitHub.
⭐ Don't forget to star this repository if you found it helpful!