Spring Boot TODO CRUD in Kotlin
Gradle based spring boot application which provide APIs to create, read, update and delete the TODOs using test driven development.
Features of the Application
- Create todo
- Read todo
- Read todos by Priority
- Read todos by Status
- Update todo
- Delete todo
POST /todos
Host: localhost:8080
Content-Type: application/json
{
"description": "Sleep",
"status": "pending",
"priority": "high"
}
{
"status": "SUCCESS",
"code": "OK",
"message": "Todo has created successfully",
"data": {
"id": 1,
"description": "Sleep",
"status": "pending",
"priority": "high"
}
}
GET /todos
Host: localhost:8080
{
"status": "SUCCESS",
"code": "OK",
"message": "Successfully fetched all Todos details",
"data": [
{
"id": 1,
"description": "Sleep",
"status": "pending",
"priority": "high"
}
]
}
API - Get Todo details by Todo id
GET /todos/{1}
Host: localhost:8080
{
"status": "SUCCESS",
"code": "OK",
"message": "Successfully fetched Todo details by id",
"data": {
"id": 1,
"description": "Sleep",
"status": "pending",
"priority": "high"
}
}
API - Get Todos by Priority
GET /todos/priority/{"high"}
Host: localhost:8080
{
"status": "SUCCESS",
"code": "OK",
"message": "Successfully fetched all Todos details",
"data": [
{
"id": 1,
"description": "Sleep",
"status": "pending",
"priority": "high"
}
]
}
API - Get Todos by Status
GET /todos/status/{"pending"}
Host: localhost:8080
{
"status": "SUCCESS",
"code": "OK",
"message": "Successfully fetched all Todos details",
"data": [
{
"id": 1,
"description": "Sleep",
"status": "pending",
"priority": "high"
}
]
}
API - Update Todo details
PUT /todos/{1}
Host: localhost:8080
Content-Type: application/json
{
"status": "started"
}
{
"status": "SUCCESS",
"code": "OK",
"message": "Todo has updated successfully",
"data": {
"id": 1,
"description": "Sleep",
"status": "started",
"priority": "high"
}
}
API - Delete a Todo by Todo id
DELETE /todos/{1}
Host: localhost:8080
{
"status": "SUCCESS",
"code": "OK",
"message": "Todo has deleted successfully",
"data": {}
}