Demo on Render
Demo Frontend usin this api on Vercel
This API, built using Fastify, Prisma, and tested with Vitest and Supertest, provides a comprehensive task management solution. It allows users to create, edit, mark as complete, filter, and delete tasks efficiently. The integration of Fastify ensures optimal performance, while Prisma offers robust database management. Vitest and Supertest contribute to a reliable, well-tested application, ensuring a seamless user experience for managing tasks.
Clone the project repository:
git clone https://github.com/YagoFGomes/api-todo-rocketseat-challenge.git
docker-compose -f docker-composer.dev.yml up -d
{
"id": uuid,
"title": string,
"description": string,
"completed_at": datetime | null,
"created_at": datetime,
"updated_at": datetime
}
To use the API, you will need to send requests to the following endpoints:
POST /tasks
Required json body
{
"title": "string",
"description": "string"
}
Return status: 201 Created
GET /tasks
Return
{
"tasks": [
{task object}
]
}
Return status: 200 OK
GET /tasks?title=title_task
# or
GET /tasks?description=task_description
# or
GET /tasks?title=title_task&description=task_description
Return status: 200 OK
{
"tasks": [
{task object},
{task object}
]
}
PUT /tasks/:id_task
Required json body
{
"title": "Title changed",
"description": "Description changed"
}
Return status: 200 OK
{
"tasks": [
{
"id": uuid,
"title": "Title changed",
"description": "Description changed",
"completed_at": null,
"created_at": datetime,
"updated_at": datetime
}
]
}
PATCH /tasks/:id_task/completed
Return status: 200 OK
{
"tasks": [
{
"id": uuid,
"title": string,
"description": string,
"completed_at": datetime, <-- save datetime
"created_at": datetime,
"updated_at": datetime
}
]
}
PATCH /tasks/:id_task/uncompleted
Return status: 200 OK
{
"tasks": [
{
"id": uuid,
"title": string,
"description": string,
"completed_at": null, <-- return to null
"created_at": datetime,
"updated_at": datetime
}
]
}
DELETE /tasks/:id_task
Return status: 200 OK
The API is tested using Vitest and Supertest. To run the tests, simply run the following command:
npm run test