A simple REST API for managing tasks built with Node.js, Express, and MongoDB.
- Create, read, update, and delete tasks
- Store tasks in MongoDB database
- RESTful architecture
- Node.js
- Express.js
- MongoDB
- Mongoose
-
Clone this repository
git clone https://github.com/yourusername/task-manager-api.git
-
Install dependencies
cd task-manager-api npm install
-
Create a
.env
file in the root directoryPORT=5000 MONGO_URI=your_mongodb_connection_string
-
Start the server
npm run dev
Method | Endpoint | Description |
---|---|---|
GET | /api/tasks | Get all tasks |
POST | /api/tasks | Create a new task |
GET | /api/tasks/:id | Get a specific task by ID |
PUT | /api/tasks/:id | Update a task |
DELETE | /api/tasks/:id | Delete a task |
POST /api/tasks
Content-Type: application/json
{
"title": "Complete project",
"description": "Finish the task manager API project"
}
PUT /api/tasks/60d21b4667d0d8992e610c85
Content-Type: application/json
{
"completed": true
}
MIT
LAHIRU