Skip to content

Latest commit

 

History

History
149 lines (136 loc) · 3.23 KB

README.md

File metadata and controls

149 lines (136 loc) · 3.23 KB

Todo List

This project is a todo list REST API made with Spring Boot.

Pre-requisites

  • JDK version 21
  • Maven
  • PostgreSQL

How to run

  1. Clone this repository

    git clone https://github.com/AlexReisC/Todo-in-Spring-Boot.git
    cd Todo-in-Spring-Boot
  2. Create the PostgreSQL database:

    CREATE DATABASE todo_spring
  1. Compile and execute the program:
    ./mvnw spring-boot:run
    CTRL+C to shutdown the application

API Endpoints

Create new task

  • 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"
    }

Get all tasks

  • URL: /todo
  • Method: GET
  • Success Response:
    [
        {
        "id": "ID",
        "title": "task title",
        "description": "task description",
        "completed": false,
        "dueDate": "2024-12-31"
        }
    ]

Get task by id

  • 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"
    }

Update a task

  • 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"
    }

Delete a task

  • URL: /todo/{id}
  • Method: DELETE
  • Success Response:
    {
        "message": "Task deleted successfully"
    }
  • Failed Response:
    {
        "message": "Task not found"
    }

Project structure

Dependencies

  • Spring Boot Web
  • Spring Data JPA
  • Spring Boot Validation
  • PostgreSQL Driver

License

This project is licensed under the MIT License - see the LICENSE file for details.