Welcome to Task Manager API, a simple API for managing tasks.
- Node.js and npm installed
- MongoDB database
-
Clone the repository:
git clone https://github.com/8309h/Taskify.git cd Backend
-
Install dependencies:
npm install
-
Set up your environment variables by creating a
.env
file in the project root and adding the following:PORT=3000 mongoUrl=your_mongodb_uri
-
Start the server:
npm run server
-
GET /api/tasks
- Get all tasks.
-
POST /api/tasks
- Create a new task.
- Request body:
{ "title": "Task Title 1", "description": "Task Description 1" }
-
PUT /api/tasks/:id
- Update a task.
- Request body (any of the following):
{ "title": "New Title" }
-
DELETE /api/tasks/:id
- Delete a task.
-
PATCH /api/tasks/:id/complete
- Mark a task as completed.
curl http://localhost:3000/api/tasks
curl -X POST -H "Content-Type: application/json" -d '{"title": "New Task", "description": "Task Description"}' http://localhost:3000/api/tasks
curl -X PUT -H "Content-Type: application/json" -d '{"title": "Updated Title"}' http://localhost:3000/api/tasks/:id
curl -X DELETE http://localhost:3000/api/tasks/:id
curl -X PUT http://localhost:3000/api/tasks/:id/complete
Feel free to contribute to this project. Fork it, create a pull request, and your contributions will be considered.