A RESTful API built with Spring Boot for managing tasks (create, read, update, delete), backed by an embedded H2 database.
- JDK 21 installed
No need to install Maven separately. This project includes the Maven Wrapper (
mvnw). No need to install a database. It uses an embedded H2 database.
- Clone the repository
git clone https://github.com/artknak/task-manager.git
cd task-manager- Run the application
# Linux/Mac
./mvnw spring-boot:run
# Windows
mvnw.cmd spring-boot:runOn Linux/Mac, if you get a "Permission denied" error, run
chmod +x mvnwfirst.
- The API will be available at
http://localhost:8080
A Postman collection is available here to test the endpoints.
Get all tasks currently saved.
GET http://localhost:8080/taskExample response:
{
"msg": "Tasks retrieved successfully.",
"data": [
{
"id": 1,
"name": "Do summary",
"dueDate": "2025-10-12",
"responsible": "Artur"
},
{
"id": 2,
"name": "Refactor code",
"dueDate": "2025-10-15",
"responsible": "John"
},
{
"id": 3,
"name": "Send email to professor",
"dueDate": "2025-10-10",
"responsible": "Maria"
}
]
}Get a single task by adding its ID after the endpoint.
GET http://localhost:8080/task/1Example response:
{
"msg": "Task retrieved successfully.",
"data": {
"id": 1,
"name": "Do summary",
"dueDate": "2025-10-12",
"responsible": "Artur"
}
}Create a task.
POST http://localhost:8080/task
Content-Type: application/json{
"name": "Test",
"dueDate": "2025-11-20",
"responsible": "Gabriela"
}Example response:
{
"msg": "Task created successfully.",
"data": {
"id": 4,
"name": "Test",
"dueDate": "2025-11-20",
"responsible": "Gabriela"
}
}Update a task by adding its ID after the endpoint.
PUT http://localhost:8080/task/1
Content-Type: application/json{
"name": "Updated task",
"dueDate": "2025-10-25",
"responsible": "Carlos"
}Example response:
{
"msg": "Task updated successfully.",
"data": {
"id": 1,
"name": "Updated task",
"dueDate": "2025-10-25",
"responsible": "Carlos"
}
}Delete a single task by adding its ID after the endpoint.
DELETE http://localhost:8080/task/1Example response:
{
"msg": "Task deleted successfully.",
"data": null
}Delete all tasks.
DELETE http://localhost:8080/taskExample response:
{
"msg": "All tasks deleted successfully.",
"data": null
}