A simple BlogApp built with Node.js, Express, and MongoDB to create, read, update, and delete blog posts.
- Create new blog posts.
- Read and display existing blog posts.
- Update and edit blog posts.
- Delete blog posts.
- Store posts in a MongoDB database.
- Node.js
- Express.js
- MongoDB
- EJS (for templates)
- HTML/CSS (for views)
To run this project on your local machine, follow these steps:
-
Clone the repository:
git clone https://github.com/education-tech-stack/BlogApp-Express-Mongo.git cd BlogApp-Express-Mongo
-
Install dependencies:
npm install
-
Start the server:
npm run start
or for dev server
npm run start:dev
-
Open a web browser and go to
http://localhost:4000
to access the BlogApp.
-
View Blog Posts:
- Visit the homepage to see all existing blog posts.
-
Create a New Post:
- Click on the "New Post" link to create a new blog post.
-
Database:
- The app stores data in a MongoDB database named
blogapp
. Make sure you have and .env file containing MONGO_URL key and MongoDB is installed and running.
- The app stores data in a MongoDB database named
index.js
: The main entry point for the Express application.models/
: Defines the data model for blog posts.controllers/
: Handles routes controllers and CRUD operations for posts.views/
: Contains the EJS templates for rendering HTML.
Contributions are welcome! If you have any suggestions or want to make improvements, feel free to fork this repository and create a pull request.
This project is open-source and available under the MIT License.
Happy Blogging! 📚📰