This is the Backend API for the Advanced Task Manager App.
Built with Node.js, Express.js, MongoDB, and Mongoose, following clean MVC architecture.
- Node.js
- Express.js
- MongoDB + Mongoose
- dotenv (environment variables)
- cors (API access control)
- nodemon (development auto-restart)
Backend/ βββ controllers/ β βββ taskControllers.js # All task CRUD logic βββ Lib/ β βββ dbConnection.js # MongoDB connection βββ Modules/ β βββ taskModule.js # Mongoose schema/model βββ Routes/ β βββ task.js # Routes definitions βββ .env # Environment variables βββ index.js # Server entry point βββ package.json
npm install
MONGO_URI= PORT=5000
Server runs by default on: http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/tasks |
Get all tasks |
| POST | /api/v1/tasks |
Create a new task |
| PUT | /api/v1/tasks/:id |
Update task |
| DELETE | /api/v1/tasks/:id |
Delete task |
| PATCH | /api/v1/tasks/:id/toggle |
update Pendding true and false task |
β Features
βοΈ RESTful API βοΈ Full CRUD operations βοΈ MongoDB storage βοΈ Async/await + try/catch error handling βοΈ No empty fields validation βοΈ Modular folder structure (MVC) βοΈ Includes CORS support βοΈ Auto restart with Nodemon
{ "_id": "65a5f3c21b23c1a9b8e9d123", "task": "Complete assignment", "completed": false, "createdAt": "2024-01-15T10:30:01.123Z" }
π§ͺ Testing Routes
You can test routes using:
Postman
Thunder Client (VS Code)
cURL
Frontend client
Example (POST):
POST http://localhost:5000/api/tasks Content-Type: application/json
{ "title": "Learn MERN Stack" }