diff --git a/README.md b/README.md index c9f367b..3ae0d3e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -🎡Music Tracker API +# 🎡 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 +## πŸ“ Project Structure + +``` πŸ“¦ Music Tracker API β”œβ”€β”€ controllers/ β”‚ └── songController.js @@ -12,114 +15,146 @@ A simple Node.js + SQLite3 project to manage a list of songs using RESTful APIs. β”œβ”€β”€ 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** -πŸ“Œ 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 +## 🧠 API Endpoints + +### GET /api/songs Returns all songs in the database. -Response: -json +**Response:** +```json +[ { "id": 1, "title": "Test Song", "artist": "Tester", "genre": "Rock" } +] +``` - -POST /api/songs +### POST /api/songs Adds a new song to the database. -Request Body: -json + +**Request Body:** +```json { "title": "Shape of You", "artist": "Ed Sheeran", "genre": "Pop" } +``` -Response: -json +**Response:** +```json { "id": 2, "title": "Shape of You", "artist": "Ed Sheeran", "genre": "Pop" } +``` + +## πŸ—ƒοΈ Database Used -πŸ—ƒοΈ Database Used -πŸ“Œ SQLite Database File: music.db -πŸŽ›οΈ Managed Using: DB Browser for SQLite -πŸ› οΈ Tables are auto-created on server start (via db.js) +- πŸ“Œ **SQLite Database File:** `music.db` +- πŸŽ›οΈ **Managed Using:** DB Browser for SQLite +- πŸ› οΈ **Tables are auto-created** on server start (via `db.js`) -🎼 Table Schema: -sql +### 🎼 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 -🌐 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 +### 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 +### 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! - +## πŸ›  Built With +- **Node.js** - JavaScript runtime +- **Express.js** - Web framework +- **SQLite3** - Database +- **HTML/CSS/JS** - Frontend +## πŸ“„ License +This project is open-source and free to use. Feel free to fork and modify for learning or improvement! +## 🀝 Contributing +1. Fork the repository +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request +## πŸ“ž Support +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!** \ No newline at end of file