This project is a todo list REST API made with Spring Boot.
- JDK version 21
- Maven
- PostgreSQL
-
Clone this repository
git clone https://github.com/AlexReisC/Todo-in-Spring-Boot.git cd Todo-in-Spring-Boot -
Create the PostgreSQL database:
CREATE DATABASE todo_spring
- SET the database credentials (URL, USERNAME, PASSWORD) in the application.properties file, if needed.
- Compile and execute the program:
CTRL+C to shutdown the application
./mvnw spring-boot:run
- URL:
/todo - Method:
POST - Body request:
{ "title": "task title", "description": "task description", "completed": false, "dueDate": "2024-12-31" } - Response:
{ "id": "ID", "title": "task title", "description": "task description", "completed": false, "dueDate": "2024-12-31" }
- URL:
/todo - Method:
GET - Success Response:
[ { "id": "ID", "title": "task title", "description": "task description", "completed": false, "dueDate": "2024-12-31" } ]
- URL:
/todo/{id} - Method:
GET - Success Response:
{ "id": "ID", "title": "task title", "description": "task description", "completed": false, "dueDate": "2024-12-31" } - Failed Response:
{ "message": "Task not found" }
- URL:
/todo/{id} - Method:
PUT - Body request:
{ "title": "new title", "description": "new description", "completed": true, "dueDate": "2024-12-25" } - Success Response:
{ "id": "ID", "title": "new title", "description": "new description", "completed": true, "dueDate": "2024-12-25" } - Failed Response:
{ "message": "Task not found" }
- URL:
/todo/{id} - Method:
DELETE - Success Response:
{ "message": "Task deleted successfully" } - Failed Response:
{ "message": "Task not found" }
TodoApplication.java: Run applicationmodel/: Model class that will be the table on databasecontroller/: Controller, handle the API Endpointsservice/: Handle the data in database and send to Controllerrepository/: Connection with database, implement SQL methodsapplication.properties: Configuration file
- Spring Boot Web
- Spring Data JPA
- Spring Boot Validation
- PostgreSQL Driver
This project is licensed under the MIT License - see the LICENSE file for details.