@@ -19,6 +19,7 @@ A RESTful API for managing tasks built with Java 21 and Spring Boot.
1919| ORM | Spring Data JPA |
2020| Validation | Spring Boot Validation |
2121| Error Handling | @ControllerAdvice |
22+ | Monitoring | Spring Actuator |
2223| Build Tool | Maven |
2324| CI/CD | GitHub Actions |
2425
@@ -41,11 +42,25 @@ java -jar target/task-manager-api-0.0.1-SNAPSHOT.jar
4142
4243---
4344
45+ ## Profiles
46+
47+ | Profile | Usage |
48+ | ---------| --------------------------------------------------------|
49+ | ` dev ` | Default. H2 database, console enabled, DDL auto-update |
50+ | ` prod ` | H2 console disabled, DDL validate only |
51+
52+ The active profile is set in ` application.properties ` . In a real deployment, override it via environment variable:
53+ ``` bash
54+ SPRING_PROFILES_ACTIVE=prod
55+ ```
56+
57+ ---
58+
4459## Database
4560
4661This project uses an H2 file-based database, stored at ` ./data/taskdb ` . Data persists between restarts.
4762
48- To inspect the database while the app is running, open the H2 console at ` http://localhost:8080/h2-console ` with the following settings:
63+ The H2 console is available in the ` dev ` profile at ` http://localhost:8080/h2-console ` with the following settings:
4964
5065| Field | Value |
5166| ----------| ------------------------------|
@@ -57,16 +72,16 @@ To inspect the database while the app is running, open the H2 console at `http:/
5772
5873## Endpoints
5974
60- | Method | Path | Description | Status |
61- | --------| --------------------------------| - -------------------------| --------|
62- | POST | ` /tasks ` | Create a task | 201 |
63- | GET | ` /tasks ` | Fetch all tasks | 200 |
64- | GET | ` /tasks/{id} ` | Fetch a task by ID | 200 |
65- | GET | ` /tasks/search/{name} ` | Fetch a task by name | 200 |
66- | GET | ` /tasks/search/status/{status} ` | Fetch tasks by status | 200 |
67- | PATCH | ` /tasks/{id}/complete ` | Mark a task as complete | 200 |
68- | DELETE | ` /tasks/{id} ` | Soft delete a task | 200 |
69- | PATCH | ` /tasks/{id} ` | Undo a delete | 200 |
75+ | Method | Path | Description | Status |
76+ | --------| --------------------------------- | -------------------------| --------|
77+ | POST | ` /tasks ` | Create a task | 201 |
78+ | GET | ` /tasks ` | Fetch all tasks | 200 |
79+ | GET | ` /tasks/{id} ` | Fetch a task by ID | 200 |
80+ | GET | ` /tasks/search/{name} ` | Fetch a task by name | 200 |
81+ | GET | ` /tasks/search/status/{status} ` | Fetch tasks by status | 200 |
82+ | PATCH | ` /tasks/{id}/complete ` | Mark a task as complete | 200 |
83+ | DELETE | ` /tasks/{id} ` | Soft delete a task | 200 |
84+ | PATCH | ` /tasks/{id} ` | Undo a delete | 200 |
7085
7186### Examples
7287
@@ -119,6 +134,18 @@ All errors return a consistent JSON response:
119134
120135---
121136
137+ ## Health Check
138+
139+ Spring Actuator exposes a health endpoint at ` http://localhost:8080/actuator/health ` :
140+
141+ ``` json
142+ {
143+ "status" : " UP"
144+ }
145+ ```
146+
147+ ---
148+
122149## Tests
123150``` bash
124151./mvnw test
@@ -148,9 +175,12 @@ src/
148175│ │ │ └── TaskService.java
149176│ │ └── TaskManagerApiApplication.java
150177│ └── resources/
151- │ └── application.properties
178+ │ ├── application.properties
179+ │ ├── application-dev.properties
180+ │ └── application-prod.properties
152181└── test/
153182 └── java/com/taskmanagerapi/
154183 ├── TaskManagerApiApplicationTests.java
184+ ├── TaskServiceTest.java
155185 └── TaskTests.java
156186```
0 commit comments