Skip to content

Commit

Permalink
⭐Nuevas funcionalidades y 🐞Solución de errores
Browse files Browse the repository at this point in the history
⭐Nuevas funcionalidades
- Se incorporo una interfaz sencilla para poder acceder a la documentación, se utiliza "thymeleaf"

🐞Solución de errores
-Cambios para solucionar error de CORS
  • Loading branch information
Marc0Franc0 committed Nov 1, 2024
1 parent fd954ed commit e6cf870
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 15 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ HELP.md
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
/target/classes/
/target/generated-sources/
/target/generated-test-sources/
/target/maven-archiver/
/target/maven-status/
/target/surefire-reports/
/target/test-classes/
/target/ExchangeRatesApi-3.2.0.jar.original
target/**
### STS ###
.apt_generated
.classpath
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# [ExchangesRatesApi](https://github.com/Marc0Franc0/ExchangesRatesApi#exchangesratesapi)

El proyecto tiene la posibilidad de consumir diferentes APIS con el objetivo de obtener los tipos de cambios en argentina y precios del mercado en dólares.
API REST que brinda información actualizada sobre las tasas de cambio de USD y otras monedas en Argentina. También sobre el valor de acciones en USD.

## Características
- Consumo de APIS externas

## Tecnologías
- Spring Boot 3.0
- Spring Boot 3.2.0
- Maven

## Ejecución
Expand All @@ -32,8 +32,7 @@ docker start app-exchange-rates
```

Dirigirse a:
- Documentación JSON: /api/v3/api-docs
- Documentación Swagger: /doc/swagger-ui/index.html
- [Aquí](http://localhost:8080)

## Requerimientos para ejecutar con Maven

Expand All @@ -52,5 +51,4 @@ mvn spring-boot:run
```

Dirigirse a:
- Documentación JSON: /api/v3/api-docs
- Documentación Swagger /doc/swagger-ui/index.html
- [Aquí](http://localhost:8080)
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public WebMvcConfigurer corsConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry
.addMapping("*")
.addMapping("/**")
.allowedMethods("*")
.allowedOrigins("*")
.exposedHeaders("*");
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/app/ExchangeRates/controller/HomeController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.app.ExchangeRates.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {
@Value("${openapi.service.url}")
private String openApiUrl;
@Value("${spring-doc.api-docs.path}")
private String apiDocsUrl;
@Value("${spring-doc.swagger-ui.path}")
private String swaggerUiUrl;
@GetMapping("/")
public String home(Model model){
model.addAttribute("urlSwaggerDoc",
openApiUrl.concat(swaggerUiUrl));
model.addAttribute("urlJsonDoc",
openApiUrl.concat(apiDocsUrl));
return "index";
}
}
66 changes: 66 additions & 0 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="es" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ExchangeRatesApi</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: inline-block;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 90%;
}
h1 {
color: #333;
}
h2 {
color: #555;
font-size: 1.2em;
margin: 10px 0;
}
.button {
display: block;
margin: 10px auto;
padding: 10px 20px;
text-decoration: none;
color: white;
background-color: #007BFF;
border-radius: 5px;
transition: background-color 0.3s, transform 0.3s;
}
.button:hover {
background-color: #0056b3;
transform: scale(1.05);
}
.button i {
margin-right: 8px;
}
p {
margin-top: 15px;
font-size: 0.9em;
color: #777;
}
</style>
</head>
<body>
<div class="container">
<h1>ExchangeRatesApi</h1>
<p>Información actualizada sobre las tasas de cambio de USD y otras monedas en Argentina. También sobre el valor de acciones en USD.</p>
<a class="button" th:href="|${urlSwaggerDoc}|"><i class="fas fa-book"></i> Documentación Swagger</a>
<a class="button" th:href="|${urlJsonDoc}|"><i class="fas fa-file-alt"></i> Documentación JSON</a>
</div>
</body>
</html>

0 comments on commit e6cf870

Please sign in to comment.