— a simple task management API which i built as a take home assignment project by Ugochukwu, a Backend Engineering student at AltSchool Africa.
Requirements for the take home project
-
CRUD Operations: People should be able to create, read, update, and delete tasks. Each task should have a title and a description.
-
Database: Use MongoDB for data storage. You can create a simple instance on https://www.mongodb.com/cloud/atlas/register
-
Validation: Implement validation to ensure that all task entries have the necessary fields (i.e., title and description).
git clone https://github.com/hugolee003/task-manager.git
npm install
Update .env with example.env
npm run dev
npm run test
field | data_type | constraints |
---|---|---|
title | string | required |
description | string | required |
status | string | enum ['Todo', 'In Progress', 'Completed'] |
- Route: /tasks
- Method: POST
👇 Body
{
"title": "bimpe",
"description": "wake up by 6:30am today",
"status": "Completed"
}
👇 Response
{
"_id": "648d3285322a9779c4de3bc5",
"title": "bimpe",
"description": "wake up by 6:30am today",
"status": "Completed",
"createdAt": "2023-06-17T04:11:49.796Z",
"updatedAt": "2023-06-17T04:11:49.796Z",
"__v": 0
}
- Route: /tasks
- Method: Get
👇 Body
👇 Response
[
{
"_id": "648cf85ef5fd11f8dbca40ce",
"title": "Hello Wolrd",
"description": "HOW ARE YOU",
"status": "Todo",
"__v": 0
},
{
"_id": "648d03a7ee5745ac97f091c8",
"title": "features",
"description": "new features will be regularly updated to this CRUD app",
"status": "Todo",
"__v": 0
},
{
"_id": "648d05ab3c018153d29ffcfd",
"title": "mojo",
"description": "wake up by 6:30am today",
"status": "Completed",
"__v": 0
},
{
"_id": "648d05d9afe58089fedef175",
"title": "mojo",
"description": "wake up by 6:30am today",
"status": "Completed",
"createdAt": "2023-06-17T01:01:13.164Z",
"updatedAt": "2023-06-17T01:01:13.164Z",
"__v": 0
},
{
"_id": "648d2bb1f802ad39646bd86e",
"title": "mojo",
"description": "wake up by 6:30am today",
"status": "todo",
"createdAt": "2023-06-17T03:42:41.997Z",
"updatedAt": "2023-06-17T03:43:54.053Z",
"__v": 0
},
{
"_id": "648d2c84bcc1064268dfeaba",
"title": "bimpe",
"description": "wake up by 6:30am today",
"status": "Completed",
"createdAt": "2023-06-17T03:46:12.272Z",
"updatedAt": "2023-06-17T03:46:12.272Z",
"__v": 0
},
{
"_id": "648d3285322a9779c4de3bc5",
"title": "bimpe",
"description": "wake up by 6:30am today",
"status": "Completed",
"createdAt": "2023-06-17T04:11:49.796Z",
"updatedAt": "2023-06-17T04:11:49.796Z",
"__v": 0
}
]
- Route: /tasks/:id
- Method: PUT
👇 Body
{
"title": "Alarm",
"description": "wake up by 7:30 instead",
"status": "In Progress"
}
👇 Response
{
"_id": "648cf85ef5fd11f8dbca40ce",
"title": "Alarm",
"description": "wake up by 7:30 instead",
"status": "In Progress",
"__v": 0,
"updatedAt": "2023-06-17T06:42:25.120Z"
}
- Route: /tasks/:id
- Method: DELETE
- Twitter - @hugo_lee003
- email - jamesegeonu003@gmail.com
Project Link: Task manager