This project is one of the beginners' backend projects in roadmap.sh.
See also the project description).
Make sure you have node installed.
Create a MongoDB cluster. Create a .env file.
MONGO_URI=mongodb+srv://<username>:<password>@cluster0.z4femdq.mongodb.net/platform-blog?retryWrites=true&w=majority&appName=Cluster0Create a new blog post using the POST method
POST /posts
{
"title": "My First Blog Post",
"content": "This is the content of my first blog post.",
"category": "Technology",
"tags": ["Tech", "Programming"]
}
Note: Category must be one of the predefined options - technology, health, lifestyle, education or food.
Update an existing blog post using the PUT method
PUT /posts/1
{
"title": "My Updated Blog Post",
"content": "This is the updated content of my first blog post.",
"category": "Technology",
"tags": ["Tech", "Programming"]
}
Delete an existing blog post using the DELETE method
DELETE /posts/1
Get a single blog post using the GET method
GET /posts/1
Get all blog posts using the GET method
GET /posts
While retrieving posts, user can also filter posts by a search term. For example:
GET /posts?term=tech