This is a simple RESTful API for a personal blogging platform, built with Node.js, Express, and MongoDB Atlas.
It’s inspired by the roadmap.sh blogging platform project.
This project helps you:
- Understand RESTful APIs and best practices
- Use common HTTP methods: GET, POST, PUT, DELETE
- Handle status codes and error handling
- Perform CRUD operations
- Work with MongoDB Atlas using Mongoose
- Test with Postman
- Node.js
- Express.js
- MongoDB Atlas
- Mongoose
- Postman
- Render for deployment
POST /createRequest Body:
{
"title": "My First Blog Post",
"content": "This is the content of my first blog post.",
"category": "Technology",
"tags": ["Tech", "Programming"]
}- 201 Created — Returns the created post
- 400 Bad Request — Validation failed
PUT /posts/:idRequest Body:
{
"title": "Updated Title",
"content": "Updated content.",
"category": "Technology",
"tags": ["Updated", "Tag"]
}- 200 OK — Updated post returned
- 400 Bad Request — Validation failed
- 404 Not Found — Post not found
DELETE /posts/:id- 204 No Content — Successfully deleted
- 404 Not Found — Post not found
GET /posts/:id- 200 OK — Returns the post
- 404 Not Found — Post not found
GET /postsOptional search by term:
GET /posts?term=tech- Searches
title,content, orcategory(case-insensitive) - 200 OK — Array of posts
{
"id": 1,
"title": "My First Blog Post",
"content": "This is the content of my first blog post.",
"category": "Technology",
"tags": ["Tech", "Programming"],
"createdAt": "2021-09-01T12:00:00Z",
"updatedAt": "2021-09-01T12:00:00Z"
}# Clone the repo
git clone https://github.com/kyt47000/Blogging-Platform-API.git
# Install dependencies
npm install
# Add your MongoDB URI to a .env file
MONGO_URL="your-mongodb-uri"
# Start the server
node index.jsUse Postman to test your endpoints!
We welcome contributions! Please fork the repository and submit a pull request.
This project is based on the roadmap.sh Blogging Platform API.
Distributed under the MIT License. See LICENSE for details.
Yash — GitHub
Q: How can I contribute to this project?
A: We welcome contributions! Please fork the repository and submit a pull request.
Q: How do I run this project locally?
A: Follow the instructions in the 'How to Run Locally' section.
Happy Blogging! 🚀