Blogging Website Welcome to the Blogging Website project! This documentation will guide you through setting up, running, and deploying your own instance of this blogging platform.
Table of Contents Project Overview Features Prerequisites Installation Configuration Running the Application Deploying to AWS Contributing License Project Overview This project is a full-featured blogging platform where users can sign up, create, edit, and delete blog posts. The application uses Node.js, Express.js, MongoDB, and EJS for server-side rendering.
Features User authentication (sign up, sign in, sign out) Create, read, update, and delete (CRUD) blog posts Add comments to blog posts User roles (Admin, User) Image uploads for blog posts Responsive design using Bootstrap Prerequisites Node.js (v14 or later) npm (v6 or later) MongoDB Atlas account for remote database hosting AWS account for deployment (Optional) Installation Clone the repository:
sh Copy code git clone https://github.com/yourusername/blogging-website.git cd blogging-website Install dependencies:
sh Copy code npm install Install the dotenv package:
sh Copy code npm install dotenv Configuration Environment Variables: Create a .env file in the root directory of your project and add the following variables:
plaintext Copy code MONGO_URL=mongodb+srv://:@cluster0.mongodb.net/?retryWrites=true&w=majority PORT=3000 Replace , , and with your MongoDB Atlas credentials.
Directory Structure: Ensure your project has the following structure:
arduino Copy code blogging-website/ ├── models/ │ ├── blog.js │ └── comment.js │ └── user.js ├── public/ │ ├── uploads/ │ ├── styles/ │ └── scripts/ ├── routes/ │ ├── blogroute.js │ └── route.js ├── views/ │ ├── partials/ │ ├── addblog.ejs │ ├── blog.ejs │ ├── home.ejs │ ├── signin.ejs │ ├── signup.ejs ├── .env ├── index.js └── package.json Running the Application Start the server:
sh Copy code node index.js Access the application: Open your web browser and navigate to http://localhost:3000.
Deploying to AWS Set Up AWS Elastic Beanstalk:
Install the AWS Elastic Beanstalk CLI. Initialize your project with eb init and follow the prompts to set up your Elastic Beanstalk environment. Deploy Your Application:
Run eb create to create a new environment. Run eb deploy to deploy your application. Set Environment Variables in Elastic Beanstalk:
Go to the Elastic Beanstalk console. Select your application, and go to Configuration. In the Software section, edit the environment properties and add the MONGO_URL environment variable with your connection string. Contributing We welcome contributions to improve this project. Here are some ways you can help:
Report bugs and issues Suggest new features and enhancements Submit pull requests to fix bugs or add features License This project is licensed under the MIT License. See the LICENSE file for details.