This Blog Website is a full-stack web application that allows users to read, write, edit, and delete blog posts. It's built using Node.js, Express, MongoDB, and Bootstrap for styling. The website features a simple yet elegant interface for seamless user interaction with blog posts.
- Create Article: Users can write new blog posts.
- Edit Article: Users can modify existing blog posts.
- Delete Article: Users can remove blog posts.
- Responsive Design: Using Bootstrap for a mobile-friendly user experience.
- Front-end: HTML, CSS, Bootstrap CDN
- Back-end: Node.js, Express
- Database: MongoDB
- Dependencies: dompurify, dotenv, ejs, express, jsdom, marked, method-override, mongoose, slugify
- Dev Dependencies: nodemon
/blog-website
├── models/
│ └── article.js
├── node_modules/
├── routes/
│ └── articles.js
├── views/
│ └── articles/
│ ├── edit.ejs
│ ├── form_field.ejs
│ ├── index.ejs
│ ├── new.ejs
│ └── show.ejs
├── .env
├── .gitignore
├── package-lock.json
├── package.json
├── README.md
└── server.js
- Clone the repository
git clone https://github.com/imatularyan/blog-website.git
cd blog-website
- Install dependencies
npm install
- Environment Variables
Create a
.env
file in the project root directory and add your MongoDB credentials and the desired port number.
MONGODB_USERNAME=yourMongoDBUsername
MONGODB_PASSWORD=yourMongoDBPassword
DATABASE_NAME=blogDB
PORT=3000
- Start the server
npm start
Alternatively, if you have nodemon installed, you can use it for development purposes.
nodemon server.js
After starting the server, open http://localhost:3000
in your browser to view the blog website. From there, you can navigate the site to create, edit, and delete articles, as well as read posts written by others.
Contributions to the blog website project are welcome. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/AmazingFeature
). - Commit your changes (
git commit -m 'Add some AmazingFeature'
). - Push to the branch (
git push origin feature/AmazingFeature
). - Open a pull request.