KR Medium
A simple Node.js CRUD (Create, Read, Update, Delete) application using Express, MongoDB, EJS, and Multer for file uploads. Users can create, view, update, and delete stories with optional image uploads. access site on this link https://kr-medium.onrender.com/

- Create stories with title, author, date, time, and content.
- Upload images for each story.
- View all stories on the homepage.
- Update and delete stories.
- Responsive UI styled with CSS.
- Uses MongoDB for data storage.
.
├── .env
├── .gitignore
├── index.html
├── package.json
├── server.js
├── public/
│ ├── create_product.html
│ ├── main.js
│ ├── css/
│ │ └── style.css
│ └── uploads/
│ └── [uploaded images]
├── views/
│ └── index.ejs
└── .vscode/
└── settings.json
-
Clone the repository
git clone <repo-url> cd crud
-
Install dependencies
npm install
-
Configure environment variables
Create a.envfile in the root directory with the following:PORT=4000 DB_string=your_mongodb_connection_string -
Start the server
npm start
Or for development with auto-reload:
npm run dev
-
Access the app
Open http://localhost:4000 in your browser.
- Homepage: Lists all stories.
- Write Story: Click "Write" in the header to add a new story.
- Image Upload: Images are saved in
public/uploads. - Update/Delete: Use the update and delete buttons (see public/main.js).
server.js: Main server file, sets up routes and database connection.views/index.ejs: EJS template for displaying stories.public/create_product.html: Form for creating new stories.public/main.js: Frontend JS for update/delete actions.public/css/style.css: Stylesheet.
ISC
Note:
- Ensure MongoDB is running and accessible via your connection string.
- Uploaded images are stored in
public/uploads. - For any issues, check the