This is the backend of the DevHub Blog Application, built with Node.js, Express, and MongoDB. It powers all user authentication, profile management, and post-related functionalities, including secure role-based access and image support via Firebase.
🔗 Base URL
You can test and explore all endpoints with Postman:
- 🔐 JWT Authentication (Login / Register)
- 🧠 Google OAuth via Firebase
- 🧑💼 Role-based Access (Admin-only post creation)
- 📬 RESTful APIs for managing users and blog posts
- 📸 Profile picture upload (Firebase URL supported)
- 🔍 Search by blog title, content, or category
- 🛡️ Protected Routes using middleware
- ⚙️ CORS & Cookie Management
- ✅ Validation & Error Handling
- Node.js + Express.js
- MongoDB + Mongoose
- JWT (Authentication)
- bcryptjs (Password hashing)
- Firebase Auth (Google OAuth)
- CORS, dotenv, cookie-parser
Method | Endpoint | Description | Protected |
---|---|---|---|
POST | /api/auth/register-user |
Register new user | ❌ |
POST | /api/auth/signin-user |
Sign in with email/password | ❌ |
POST | /api/auth/googleauth |
Sign in with Google | ❌ |
PUT | /api/user/update/:id |
Update user profile | ✅ |
DELETE | /api/user/delete/:id |
Delete user account | ✅ |
POST | /api/post/createpost |
Create new post (Admin only) | ✅ |
GET | /api/post/getallposts?search= |
Fetch all posts or search by keyword | ✅ |
GET | /api/post/getpost/:id |
Fetch single post by ID | ✅ |