🔐 Admin Routes
POST
/api/admin/login
Admin authentication endpoint
Request Body:
email: string (required)
password: string (required)
Response: { success: boolean, token?: string, message?: string }
GET
/api/admin/get-all-blogs
AUTH REQUIRED
Get all blogs (admin view)
Response: { success: boolean, blogs: Array }
GET
/api/admin/get-all-comments
AUTH REQUIRED
Get all comments with blog information
Response: { success: boolean, comments: Array }
GET
/api/admin/get-dashboard
AUTH REQUIRED
Get dashboard statistics
Response: { success: boolean, dashboardData: { blogs, comments, drafts, recentBlogs } }
POST
/api/admin/delete-blog-comment
AUTH REQUIRED
Delete a comment by ID
Request Body:
id: string (required)
Response: { success: boolean, message: string }
POST
/api/admin/approve-comment
AUTH REQUIRED
Approve a comment by ID
Request Body:
id: string (required)
Response: { success: boolean, message: string }
📝 Blog Routes
POST
/api/blog/add
AUTH REQUIRED
Create a new blog post
Request (multipart/form-data):
image: File (required)
blog: JSON string { title, subTitle, description, category, isPublished }
Response: { success: boolean, message: string }
GET
/api/blog/all
Get all published blogs
Response: { success: boolean, blogs: Array }
GET
/api/blog/:blogId
Get a specific blog by ID
URL Parameters:
blogId: string (required)
Response: { success: boolean, blog: Object }
POST
/api/blog/update/:blogId
AUTH REQUIRED
Update an existing blog post
URL Parameters:
blogId: string (required)
Request (multipart/form-data):
image: File (optional)
blog: JSON string { title, subTitle, description, category, isPublished }
Response: { success: boolean, message: string }
POST
/api/blog/delete
AUTH REQUIRED
Delete a blog by ID
Request Body:
id: string (required)
Response: { success: boolean, message: string }
POST
/api/blog/toggle-publish
AUTH REQUIRED
Toggle publish status of a blog
Request Body:
id: string (required)
Response: { success: boolean, message: string }
POST
/api/blog/generate-blog
AUTH REQUIRED
Generate blog content using AI
Request Body:
prompt: string (required)
Response: { success: boolean, content: string }
POST
/api/blog/add-comment
Add a comment to a blog
Request Body:
blog: string (blog ID, required)
name: string (required)
content: string (required)
Response: { success: boolean, message: string }
POST
/api/blog/get-comments
Get approved comments for a blog
Request Body:
blogId: string (required)
Response: { success: boolean, comments: Array }