A backend API for managing a blogging platform, built using Node.js and MongoDB with Mongoose.
- Create Post: Allows users to create new blog posts.
- Like Post: Users can like or dislike posts.
- Create Comment: Users can add comments to posts.
- title:
String
(required, max length: 20) - body:
String
(required) - likes:
[ObjectId]
(referenceslike
model) - comments:
[ObjectId]
(referencescomment
model, default: "no comments") - createdate:
Date
(required, default: current date)
- post:
ObjectId
(referencespost
model) - user:
String
(required) - body:
String
(required)
- post:
ObjectId
(referencespost
model) - user:
String
(required)
-
Clone the repository
git clone https://github.com/yourusername/your-repository.git
-
Navigate to the project directory
cd your-repository
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env
file in the root directory with the following content:MONGODB_URI=your_mongodb_connection_string
-
Start the server
npm start