Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akunna1/api-mysql-node-express
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
https://github.com/akunna1/api-mysql-node-express
crud-api database express-js multer mysql node-js
Last synced: about 1 month ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/akunna1/api-mysql-node-express
- Owner: akunna1
- Created: 2024-09-09T15:37:02.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-09T16:01:57.000Z (2 months ago)
- Last Synced: 2024-09-30T12:23:29.789Z (about 2 months ago)
- Topics: crud-api, database, express-js, multer, mysql, node-js
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
- Create a database and a posts table with fields for the id, message, and image_url to store post details...
#### Steps
- Install Required Packages: npm init -y, npm install express mysql multer body-parser
- Creating the posts table:CREATE DATABASE social_media_db;
USE social_media_db;
CREATE TABLE posts (
id INT AUTO_INCREMENT PRIMARY KEY,
message VARCHAR(255) NOT NULL,
image_url VARCHAR(255)
);#### API Endpoints (index.js)
- Create Post (with image): POST /posts (Form-data: message, image)
- Get All Posts: GET /posts
- Get Single Post: GET /posts/:id
- Update Post (with new image): PUT /posts/:id (Form-data: message, image)
- Delete Post: DELETE /posts/:id