This README provides an overview of your Blog Express.js application and the technologies you used. It includes a brief description, dependencies, project structure, and other important details. This will help users understand your project and get started with it.
This is a Blog application built using Express.js, MongoDB, EJS for templating, and Node.js. It allows users to create, read, update, and delete blog posts. The application uses the Mongoose library to interact with a MongoDB database for storing and managing blog posts.
The project is organized as follows:
|-- controllers
|-- models
|-- public
|-- routes
|-- views
|app.js
-
controllers
: Contains the controller files that handle various functionalities of the application. -
models
: Includes the data models for the blog posts using Mongoose. -
public
: Houses the static assets, in this case, astyle.css
file for styling your application. -
routes
: Contains route files to define the various routes for the application. -
views
: Holds the EJS templates used for rendering views in the application. -
app.js
: This is the main application file that configures and runs your Express.js server.
You have listed the following dependencies in your package.json
file:
- express: A minimal and flexible Node.js web application framework.
- mongoose: An Object Data Modeling (ODM) library for MongoDB, which allows you to interact with MongoDB in a more structured way.
- ejs: A simple templating language that allows you to embed JavaScript code within HTML templates.
- morgan: A middleware for logging HTTP requests to the console.
- nodemon: A development utility that automatically restarts the server when you make changes to your code.
The application supports the following CRUD operations for managing blog posts:
-
Create: Users can create new blog posts by submitting a form with the post content.
-
Read: Users can view a list of existing blog posts and click on individual posts to read them in detail.
-
Update: Users can edit and update existing blog posts by clicking on an "Edit" button.
-
Delete: Users can delete blog posts by clicking on a "Delete" button.
To set up and run the project, follow these steps:
- Clone the repository to your local machine.
- Navigate to the project's root directory.
- Run the following command to install the project dependencies:
## npm install
- Start the application by running:
## npm start
This will start the server, and you can access the application in your web browser at http://localhost:3000
.
The application should now be running locally. You can use it to create, read, update, and delete blog posts. You can access the different routes defined in your application's routes
folder and customize it as needed.
The application also includes the following additional pages and routes:
This project requires Node.js version 18.x or higher.
Happy coding!