Create, edit, delete and visualize forum threads.
Sample project created for studying Spring Boot technology.
- Form Objects
- DTO Objects
- Repository
- Rest Verbs: GET, PUT, POST and DELETE
- H2 Database Engine
- Spring Data JPA
- Bean Validation
- RestControllerAdvice
- Spring Data Pagination and Ordering
- Spring Cache
- JWT Token Authentication
- Spring Security
- Spring Profiles
- Spring Boot Admin Client
- Spring Boot Unit Tests
- SpringFox Swagger
- data.sql for initialization inserts
- DevTools
GET
/threads
Response
{
"content": [
{
"id": 3,
"title": "Dúvida 3",
"message": "Tag HTML",
"creationDate": "2019-05-05T20:00:00"
},
{
"id": 2,
"title": "Dúvida 2",
"message": "Projeto não compila",
"creationDate": "2019-05-05T19:00:00"
}
],
"pageable": {
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"pageSize": 10,
"pageNumber": 0,
"offset": 0,
"paged": true,
"unpaged": false
},
"totalPages": 1,
"totalElements": 3,
"last": true,
"first": true,
"sort": {
"sorted": true,
"unsorted": false,
"empty": false
},
"numberOfElements": 3,
"size": 10,
"number": 0,
"empty": false
}
GET
/threads/:id
Response
{
"id": 1,
"title": "Dúvida",
"message": "Erro ao criar projeto",
"criation": "2019-05-05T18:00:00",
"autorsName": "Aluno",
"status": "NOT_ANSWERED",
"answers": []
}
POST
/threads
{
"title": "New Thread",
"message": "Message about thread",
"courseName": "Course Name"
}
Response
{
"id": 4,
"title": "New Thread",
"message": "Message about thread",
"creationDate": "2019-08-19T23:10:48.408"
}
DELETE
/threads/:id
Response Code: 200
PUT
/threads/:id
{
"title": "New thread",
"message": "Message about the thread",
"courseName": "Course Name"
}
Response
{
"id": 2,
"title": "New thread",
"message": "Message about the thread",
"creationDate": "2019-05-05T19:00:00"
}
POST
/auth
{
"email" : "[email protected]",
"password": "password"
}
Response
{
"token": "token",
"type": "Bearer"
}
docker run
-p 8080:8080
-e FORUM_DATABASE_URL='jdbc:h2:mem:springboot-forum'
-e FORUM_DATABASE_USERNAME=sa
-e FORUM_DATABASE_PASSWORD=''
-e FORUM_DATABASE_SECRET=''
-e SPRING_PROFILES_ACTIVE='prod'
marcosaraujo/spring-boot-forum
PORT=8080
PORT_ADMIN=8081
FORUM_DATABASE_URL='jdbc:h2:mem:springboot-forum'
FORUM_DATABASE_USERNAME=sa
FORUM_DATABASE_PASSWORD=''
FORUM_DATABASE_SECRET=''
SPRING_PROFILES_ACTIVE='prod'
ADMIN_HOST='admin'
docker-compose up
Spring Boot Admin Sample Project.
An administration UI for Spring Boot applications.
docker run -p 8081:8081 -e PORT=8081 marcosaraujo/spring-boot-admin