A demo Spring Boot REST API for managing TODO items with mock data.
- REST API for TODO CRUD operations
- Mock data service (no database required)
- Comprehensive unit tests
- Docker support
- VS Code Dev Container ready
- Java 17+
- Maven 3.6+
- Docker (optional)
./mvnw spring-boot:run
The API will be available at http://localhost:8080
OpenAPI documentation is available at:
- Swagger UI:
http://localhost:8080/swagger-ui/index.html
- OpenAPI JSON:
http://localhost:8080/v3/api-docs
./mvnw test
./mvnw clean package
java -jar target/todo-api-1.0.0.jar
docker build -t todo-api .
docker run -p 8080:8080 todo-api
Base URL: http://localhost:8080/api/todos
Method | Endpoint | Description |
---|---|---|
GET | /api/todos |
Get all todos |
GET | /api/todos/{id} |
Get todo by ID |
POST | /api/todos |
Create new todo |
PUT | /api/todos/{id} |
Update existing todo |
DELETE | /api/todos/{id} |
Delete todo |
curl http://localhost:8080/api/todos
curl -X POST http://localhost:8080/api/todos \
-H "Content-Type: application/json" \
-d '{"title":"New Task","description":"Task description","completed":false}'
curl -X PUT http://localhost:8080/api/todos/1 \
-H "Content-Type: application/json" \
-d '{"title":"Updated Task","description":"Updated description","completed":true}'
curl -X DELETE http://localhost:8080/api/todos/1
Open the project in VS Code and select "Reopen in Container" when prompted, or use the Command Palette: Remote-Containers: Reopen in Container
The application starts with 3 sample todos:
- "Learn Spring Boot" - not completed
- "Build TODO API" - not completed
- "Write unit tests" - completed
src/
├── main/java/com/demo/todoapi/
│ ├── TodoApiApplication.java # Main application class
│ ├── controller/
│ │ └── TodoController.java # REST controller
│ ├── model/
│ │ └── Todo.java # Todo model
│ └── service/
│ └── TodoService.java # Business logic with mock data
└── test/java/com/demo/todoapi/
├── controller/
│ └── TodoControllerTest.java # Controller tests
└── service/
└── TodoServiceTest.java # Service tests