API RESTful utilizando Spring Boot que gerencia produtoras de games.
- Spring Boot DevTools
- Spring Web
- Flyway
- Validation
- Spring Data JPA
- Java JWT
- Docker
- Spring Doc OpenAPI 3
- Spring HATEOAS
- Spring Security
- Prometheus
- Jib
- GitHub Actions
- Grafana
- Modelmapper
- MySQL
- Clonar o repositório:
git clone https://github.com/Versart/apigames
- Entrar no diretório clonado e executar o comando:
docker compose up
- A aplicação poderá ser acessada em localhost:8080/swagger-ui.html
Para fazer requisições, é necessário primeiramente se registrar, e depois fazer login para receber um token, este deve ser enviado em todas requisições. Para maiores informações dos endpoints, você poderá acessar a documentação em: localhost:8080/swagger-ui.html
- POST /auth/register
Example Request
{
"login": "maria",
"password": "12345678",
"role": "ADMIN"
}
Example Response
{
"login": "maria",
"dataCriacao": "2023-09-04T23:08:06.982Z"
}
- POST /auth/login
Example Request
{
"login": "maria",
"password": "12345678"
}
Example Response
eyJhbGciOiJIUzI1NiIsInR5cCI.............................................
- POST /companies
Example Request
{
"name" : "Nintendo",
"dateOfFoundation" : "1889-09-23"
}
Example Response
{
"id": 1,
"name": "Nintendo",
"dateOfFoundation": "1889-09-23",
"_links": {
"self": {
"href": "http://localhost:8080/companies/1"
}
}
}
- GET /companies
Example Response
{
"_embedded": {
"companyResponseList": [
{
"id": 1,
"name": "Nintendo",
"dateOfFoundation": "1889-09-23",
"_links": {
"self": {
"href": "http://localhost:8080/companies/1"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/companies?page=0&size=20"
}
},
"page": {
"size": 20,
"totalElements": 1,
"totalPages": 1,
"number": 0
}
}
- GET /companies/{id}
Example Request
/companies/1
Example Response
{
"id": 1,
"name": "Nintendo",
"dateOfFoundation": "1889-09-23",
"_links": {
"self": {
"href": "http://localhost:8080/companies/1"
}
}
}
- GET /companies/find?name=?
Example Request
/companies/find?name=nint
Example Response
{
"_embedded": {
"companyResponseList": [
{
"id": 1,
"name": "Nintendo",
"dateOfFoundation": "1889-09-23",
"_links": {
"self": {
"href": "http://localhost:8080/companies/1"
}
}
}
]
}
}
- PUT /companies/{id}
Example Request
/companies/1
{
"name": "Nintendo 2",
"dateOfFoundation": "1889-09-23"
}
Example Response
{
"id": 1,
"name": "Nintendo 2",
"dateOfFoundation": "1889-09-23",
"_links": {
"self": {
"href": "http://localhost:8080/companies/1"
}
}
}
- DELETE /companies/{id}
Example Request
/companies/1
- POST /games
Example Request
{
"name": "Contra ",
"category": "ACTION",
"companyId": 2
}
Example Response
{
"name": "Contra ",
"companyName": "Nintendo",
"_links": {
"self": {
"href": "http://localhost:8080/games/1"
},
"All Games": {
"href": "http://localhost:8080/games"
}
}
}
- GET /games
Example Request
/games
{
"_embedded": {
"gameResponseDTOList": [
{
"name": "Contra ",
"companyName": "Nintendo",
"_links": {
"self": {
"href": "http://localhost:8080/games/1"
},
"All Games": {
"href": "http://localhost:8080/games"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/games"
}
}
}
- GET /games/{id}
Example Request
/games/1
Example Response
{
"name": "Contra ",
"companyName": "Nintendo",
"_links": {
"self": {
"href": "http://localhost:8080/games/1"
},
"All Games": {
"href": "http://localhost:8080/games"
}
}
}
- PUT /games/{id}
Example Request
/companies/1
{
"name": "Contra 2",
"category": "ACTION",
"companyId": 2
}
{
"name": "Contra 2",
"companyName": "Nintendo",
"_links": {
"self": {
"href": "http://localhost:8080/games/1"
},
"All Games": {
"href": "http://localhost:8080/games"
}
}
}
- DELETE /games/{id}
Example Request
/games/1