Skip to content

Latest commit

 

History

History
76 lines (51 loc) · 1.6 KB

readme.md

File metadata and controls

76 lines (51 loc) · 1.6 KB

Blogging Platform API

This project is one of the beginners' backend projects in roadmap.sh.

See also the project description).

Getting Started

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=Cluster0

Create Blog Post

Create 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 Blog Post

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 Blog Post

Delete an existing blog post using the DELETE method

DELETE /posts/1

Get Blog Post

Get a single blog post using the GET method

GET /posts/1

Get All Blog Posts

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