{"id":15068210,"url":"https://github.com/akunna1/api-mysql-node-express","last_synced_at":"2026-01-03T11:32:47.858Z","repository":{"id":256233387,"uuid":"854678555","full_name":"akunna1/API-MySQL-Node-Express","owner":"akunna1","description":"Creating an API using MySQL, Express.js, and Node.js to create a social media post with CRUD operations. The post includes a message and an image upload","archived":false,"fork":false,"pushed_at":"2024-09-09T16:01:57.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T18:51:29.839Z","etag":null,"topics":["crud-api","database","express-js","multer","mysql","node-js"],"latest_commit_sha":null,"homepage":"","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/akunna1.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}},"created_at":"2024-09-09T15:37:02.000Z","updated_at":"2024-09-09T16:02:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3b9da4a-f664-46e5-bc9c-3f8e921ad99e","html_url":"https://github.com/akunna1/API-MySQL-Node-Express","commit_stats":null,"previous_names":["akunna1/api-mysql-node-express"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akunna1%2FAPI-MySQL-Node-Express","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akunna1%2FAPI-MySQL-Node-Express/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akunna1%2FAPI-MySQL-Node-Express/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akunna1%2FAPI-MySQL-Node-Express/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akunna1","download_url":"https://codeload.github.com/akunna1/API-MySQL-Node-Express/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243833430,"owners_count":20355270,"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":["crud-api","database","express-js","multer","mysql","node-js"],"created_at":"2024-09-25T01:32:27.412Z","updated_at":"2026-01-03T11:32:47.846Z","avatar_url":"https://github.com/akunna1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API-MySQL-Node-Express\n\nThis project demonstrates how to create a social media post API using MySQL, Express.js, and Node.js. The API supports CRUD operations including image upload.\n\n---\n\n## Features\n\n* Create posts with a message and an image URL\n* Retrieve all posts or a single post by ID\n* Update posts with new messages and images\n* Delete posts\n\n---\n\n## Technologies Used\n\n* Node.js\n* Express.js\n* MySQL\n* Multer (for handling image uploads)\n* Body-parser (to parse request bodies)\n\n---\n\n## Database Setup\n\nCreate the database and posts table:\n\n```sql\nCREATE DATABASE social_media_db;\n\nUSE social_media_db;\n\nCREATE TABLE posts (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  message VARCHAR(255) NOT NULL,\n  image_url VARCHAR(255)\n);\n```\n\n---\n\n## Installation\n\n1. Initialize npm and install dependencies:\n\n```bash\nnpm init -y\nnpm install express mysql multer body-parser\n```\n\n2. Configure your MySQL connection in your Node.js app.\n\n3. Start the server:\n\n```bash\nnode index.js\n```\n\n---\n\n## API Endpoints\n\n| Method | Endpoint     | Description                              |\n| ------ | ------------ | ---------------------------------------- |\n| POST   | `/posts`     | Create a new post with image             |\n| GET    | `/posts`     | Retrieve all posts                       |\n| GET    | `/posts/:id` | Retrieve a single post by ID             |\n| PUT    | `/posts/:id` | Update a post with new message and image |\n| DELETE | `/posts/:id` | Delete a post by ID                      |\n\n---\n\n## Notes\n\n* Image uploads are handled with Multer middleware.\n* Requests including images must be sent as multipart/form-data.\n* Images are saved and the URL stored in the database.\n* Message field stores the text content of the post.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakunna1%2Fapi-mysql-node-express","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakunna1%2Fapi-mysql-node-express","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakunna1%2Fapi-mysql-node-express/lists"}