{"id":27603979,"url":"https://github.com/killflex/express-mysql-practice","last_synced_at":"2025-04-22T19:21:32.333Z","repository":{"id":288175774,"uuid":"967078831","full_name":"killflex/express-mysql-practice","owner":"killflex","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-15T23:46:12.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T00:19:44.656Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/killflex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-15T22:37:39.000Z","updated_at":"2025-04-15T23:46:15.000Z","dependencies_parsed_at":"2025-04-16T00:30:16.131Z","dependency_job_id":null,"html_url":"https://github.com/killflex/express-mysql-practice","commit_stats":null,"previous_names":["killflex/express-mysql-practice"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killflex%2Fexpress-mysql-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killflex%2Fexpress-mysql-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killflex%2Fexpress-mysql-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killflex%2Fexpress-mysql-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/killflex","download_url":"https://codeload.github.com/killflex/express-mysql-practice/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306600,"owners_count":21408927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-22T19:21:31.862Z","updated_at":"2025-04-22T19:21:32.317Z","avatar_url":"https://github.com/killflex.png","language":"JavaScript","readme":"# Express MySQL Practice\n\nA simple Node.js CRUD API using Express and MySQL, designed for learning and practicing backend fundamentals.\n\n---\n\n## 📚 Table of Contents\n\n- [Express MySQL Practice](#express-mysql-practice)\n  - [📚 Table of Contents](#-table-of-contents)\n  - [📦 Installation](#-installation)\n  - [🚀 Usage](#-usage)\n  - [📡 API Endpoints](#-api-endpoints)\n    - [GET `/users`](#get-users)\n    - [GET `/users/:id`](#get-usersid)\n    - [POST `/users`](#post-users)\n    - [PUT `/users/:id`](#put-usersid)\n    - [DELETE `/users/:id`](#delete-usersid)\n  - [✨ Features](#-features)\n  - [⚙️ Configuration](#️-configuration)\n  - [📦 Dependencies](#-dependencies)\n  - [🛠 Troubleshooting](#-troubleshooting)\n  - [👨‍💻 Contributors](#-contributors)\n\n---\n\n## 📦 Installation\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/killflex/express-mysql-practice.git\n   cd express-mysql-practice\n   ```\n\n2. **Install dependencies**\n\n   ```bash\n   npm install\n   ```\n\n3. **Create `.env` file**\n\n   Duplicate the provided `env.example` file and rename it:\n\n   ```bash\n   cp env.example .env\n   ```\n\n   Fill in your MySQL credentials and database info.\n\n---\n\n## 🚀 Usage\n\n1. Start your MySQL server.\n2. Ensure your `.env` is correctly configured.\n3. Start the server:\n\n   ```bash\n   npm start\n   ```\n\n4. Access the API via: `http://localhost:3000`\n\n---\n\n## 📡 API Endpoints\n\n### GET `/users`\n\nReturns a list of all users.\n\n**Response:**\n\n```json\n[\n  {\n    \"id\": 1,\n    \"name\": \"John Doe\",\n    \"email\": \"john@example.com\"\n  }\n]\n```\n\n---\n\n### GET `/users/:id`\n\nReturns a single user by ID.\n\n**Response:**\n\n```json\n{\n  \"id\": 2,\n  \"name\": \"Jane Smith\",\n  \"email\": \"jane@example.com\"\n}\n```\n\n---\n\n### POST `/users`\n\nCreates a new user.\n\n**Request:**\n\n```json\n{\n  \"name\": \"New User\",\n  \"email\": \"newuser@example.com\"\n}\n```\n\n**Response:**\n\n```json\n{\n  \"message\": \"User created successfully\"\n}\n```\n\n---\n\n### PUT `/users/:id`\n\nUpdates a user's details.\n\n**Request:**\n\n```json\n{\n  \"name\": \"Updated Name\",\n  \"email\": \"updated@example.com\"\n}\n```\n\n**Response:**\n\n```json\n{\n  \"message\": \"User updated successfully\"\n}\n```\n\n---\n\n### DELETE `/users/:id`\n\nDeletes a user by ID.\n\n**Response:**\n\n```json\n{\n  \"message\": \"User deleted successfully\"\n}\n```\n\n---\n\n## ✨ Features\n\n- RESTful API using Express\n- MySQL integration with async/await\n- Environment-based configuration\n- Clean project structure\n\n---\n\n## ⚙️ Configuration\n\nEdit the `.env` file to configure your database connection:\n\n```env\nDB_HOST=localhost\nDB_USER=root\nDB_PASSWORD=yourpassword\nDB_NAME=practice_db\nPORT=3000\n```\n\n---\n\n## 📦 Dependencies\n\n- [express](https://www.npmjs.com/package/express)\n- [mysql2](https://www.npmjs.com/package/mysql2)\n- [dotenv](https://www.npmjs.com/package/dotenv)\n\n---\n\n## 🛠 Troubleshooting\n\n- Ensure your MySQL server is running.\n- Check that the database and tables exist.\n- Confirm that `.env` values are correct.\n- Look for console errors when the server starts.\n\n---\n\n## 👨‍💻 Contributors\n\n- [@killflex](https://github.com/killflex) – Original author\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillflex%2Fexpress-mysql-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkillflex%2Fexpress-mysql-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkillflex%2Fexpress-mysql-practice/lists"}