diff --git a/README.md b/README.md index c9f367b..9126fdb 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,63 @@ -🎡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
+βœ… Local database using SQLite3
+βœ… Integrated with DB Browser for SQLite3
+βœ… HTML frontend (optional)
+βœ… Backend using Node.js and Express.js
+βœ… 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 + `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 + Node.js (v14 or above)
+β†’ Required to run the backend server.
+ npm (Node Package Manager)
+ `npm install`
+β†’ Comes with Node.js. Used to install project dependencies.
+ +3. βœ… Start the Server
+ Run this command :
+ `node server.js`
+ The server will start at:
+ http://localhost:5000
+ +## 🧠 API Endpoints + +GET /api/songs
+Returns all songs in the database.
+Response: +```json { "id": 1, @@ -49,77 +65,85 @@ json "artist": "Tester", "genre": "Rock" } +``` - -POST /api/songs -Adds a new song to the database. -Request Body: -json +POST /api/songs
+Adds a new song to the database.
+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
+πŸŽ›οΈ Managed Using: DB Browser for SQLite
+πŸ› οΈ Tables are auto-created on server start (via db.js)
+ +## 🎼 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.
+πŸ”§ Features:
+🎡 Add a song using a simple form
+πŸ“‹ View all added songs in a list
+## πŸš€ How to Use: +Make sure your server is running (node server.js)
+Double-click on MusicAPI.html to open it in your browser
+Fill out the form and hit β€œAdd Song” to submit 🎢
+## 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
+- 🟩 **Node.js** – For backend JavaScript runtime
+- πŸš‚ **Express.js** – Web framework to handle routes and APIs
+- πŸ—ƒ **SQLite3** – Lightweight database for storage
+- 🌐 **HTML/CSS/JavaScript** – To power the frontend UI
+## πŸ“„ License
+This project is **open-source** and free to use!
+Feel free to **fork it**, **play around**, or even use it to build something cooler.
+Just don’t forget to give credit if you’re vibing with it πŸ’«