This is a Java Spring Boot back-end for a day planner app.
To run start: com.petproject.PetprojectApplication
Implements PagingAndSortingRepository from Spring Data
GET /api/task
Parameters:
* page Number
* size Number
* sort String
* direction String
Example response:
{
"content": [
...
{
"id": 1,
"name": "Example name",
"description": "Example description",
"done": false
},
...
],
"pageable": {
"size": 5,
"page": 0,
"totalElements": 30
},
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
}
}
POST /api/task
Example request body:
{
"name": "Task to add",
"description": "Adding a task that is done",
"isDone": true
}
Example response:
{
"id": 0,
"name": "Task to add",
"description": "Adding a task that is done",
"done": true
}
PUT /api/task/{id}
example id = 1
Example request body:
{
"name": "New name",
"description": "New description",
}
Example response:
{
"id": 1,
"name": "New name",
"description": "New description",
"done": true
}
GET /api/task/{id}
example id = 1
Example response:
{
"id": 1,
"name": "Example name",
"description": "Example description",
"done": false
}
DELETE /api/task/{id}
example id = 1
Example response:
200 OK
Example application.properties file
server.port = 8080
spring.application.name = PetProject
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/sys
spring.datasource.username=
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
server.servlet.contextPath=/api
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG
logging.level.org.springframework.jdbc.core.StatementCreatorUtils=TRACE
- Fix isDone -> done issue
- Find a better database system solution for developing