Plantilla inicial del taller
publicar / publicar (push) Failing after 6s

This commit is contained in:
taller committed 2026-11-22 18:51:27 +00:00
1 parent 37fd1f4f18
commit 4f7d614892
22 files changed
+1157

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
FROM nginx:1.29-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY . /usr/share/nginx/html
EXPOSE 8080
+22
View File
@@ -0,0 +1,22 @@
// Web de la votación. Esqueleto: muestra los resultados, pero votar aún no está hecho.
const API = window.API_URL;
async function cargarResultados() {
const caja = document.getElementById("resultados");
try {
const respuesta = await fetch(`${API}/api/resultados`);
const datos = await respuesta.json();
caja.textContent = JSON.stringify(datos);
} catch (error) {
caja.textContent = "No se pueden cargar los resultados (¿está la API en marcha? ¿CORS?)";
}
}
// TODO (equipo web): pintar las opciones de /api/opciones, enviar el voto con POST /api/votos
// y explicar al usuario cada respuesta del contrato (201, 400, 403, 409).
document.getElementById("formulario-voto").addEventListener("submit", (evento) => {
evento.preventDefault();
document.getElementById("mensaje").textContent = "Votar todavía no funciona.";
});
cargarResultados();
+2
View File
@@ -0,0 +1,2 @@
// Dirección de la API de vuestro escuadrón. La genera el taller; no hace falta tocarla.
window.API_URL = "https://escuadron-2-api.tallerprompt.org";
+29
View File
@@ -0,0 +1,29 @@
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Viaje de fin de curso</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main>
<h1>¿Ibiza o Praga?</h1>
<p>Vota el destino del viaje de fin de curso. Un voto por alumno.</p>
<!-- TODO (equipo web): formulario con el código de alumno y las opciones de /api/opciones -->
<form id="formulario-voto">
<label for="codigo">Código de alumno</label>
<input id="codigo" name="codigo" placeholder="A0001" autocomplete="off">
<div id="opciones"></div>
<button type="submit">Votar</button>
</form>
<p id="mensaje" role="status"></p>
<h2>Resultados</h2>
<div id="resultados">Cargando…</div>
</main>
<script src="config.js"></script>
<script src="app.js"></script>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
server {
listen 8080;
root /usr/share/nginx/html;
location = /healthz { return 200 "ok"; }
location / { try_files $uri $uri/ /index.html; }
}
+4
View File
@@ -0,0 +1,4 @@
body { font-family: system-ui, sans-serif; margin: 0; background: #f6f7f9; color: #1d2433; }
main { max-width: 32rem; margin: 2rem auto; padding: 0 1rem; }
form { display: grid; gap: .5rem; margin: 1rem 0; }
input, button { font: inherit; padding: .5rem; }