Update runtime ports and deployment defaults.
Switch backend/frontend to ports 8074/8075 and align Docker, CORS, frontend API base URL, and docs so deployment uses the new endpoints consistently.
This commit is contained in:
+6
-6
@@ -2,7 +2,7 @@
|
||||
|
||||
Documento resumen para entender **qué hace el usuario en cada paso**, **qué endpoint usar**, **cabeceras**, **cuerpos**, **ejemplos de respuesta** y **errores típicos**.
|
||||
|
||||
**Base URL de ejemplo:** `http://localhost:8000`
|
||||
**Base URL de ejemplo:** `http://localhost:8074`
|
||||
|
||||
---
|
||||
|
||||
@@ -131,7 +131,7 @@ Detalle de cuerpos, respuestas y errores: **sección 4** de esta guía.
|
||||
**Ejemplo:**
|
||||
|
||||
```bash
|
||||
curl -s http://localhost:8000/health
|
||||
curl -s http://localhost:8074/health
|
||||
```
|
||||
|
||||
**Respuesta OK (200):**
|
||||
@@ -165,7 +165,7 @@ curl -s http://localhost:8000/health
|
||||
**Ejemplo:**
|
||||
|
||||
```bash
|
||||
curl -s -X POST http://localhost:8000/auth/register \
|
||||
curl -s -X POST http://localhost:8074/auth/register \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"email":"profesor@ejemplo.com","password":"ClaveSegura1","full_name":"María"}'
|
||||
```
|
||||
@@ -303,7 +303,7 @@ Todas requieren: `Authorization: Bearer <token>`
|
||||
**Ejemplo mínimo:**
|
||||
|
||||
```bash
|
||||
curl -s -X POST http://localhost:8000/exam/templates \
|
||||
curl -s -X POST http://localhost:8074/exam/templates \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
@@ -415,7 +415,7 @@ Sirven para **texto** que la IA puede usar al generar (PDF, DOCX, TXT, MD; imág
|
||||
**Ejemplo:**
|
||||
|
||||
```bash
|
||||
curl -s -X POST "http://localhost:8000/exam/templates/TEMPLATE_UUID/materials" \
|
||||
curl -s -X POST "http://localhost:8074/exam/templates/TEMPLATE_UUID/materials" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-F "file=@./apuntes.pdf"
|
||||
```
|
||||
@@ -468,7 +468,7 @@ Solo para **mostrar en la pregunta** (Moodle); no rellenan el contexto de texto
|
||||
**Ejemplo:**
|
||||
|
||||
```bash
|
||||
curl -s -X POST "http://localhost:8000/exam/templates/TEMPLATE_UUID/images" \
|
||||
curl -s -X POST "http://localhost:8074/exam/templates/TEMPLATE_UUID/images" \
|
||||
-H "Authorization: Bearer $TOKEN" \
|
||||
-F "file=@./diagrama.png" \
|
||||
-F "caption=Diagrama del modelo ER"
|
||||
|
||||
@@ -31,7 +31,7 @@ docker compose up --build
|
||||
La API queda disponible en:
|
||||
|
||||
```text
|
||||
http://localhost:8000
|
||||
http://localhost:8074
|
||||
```
|
||||
|
||||
## Configuración
|
||||
|
||||
@@ -9,7 +9,7 @@ API_KEY=change-me-in-production-min-16-chars
|
||||
DATABASE_URL=postgresql+psycopg://genexamenes:genexamenes@db:5432/genexamenes
|
||||
|
||||
# --- CORS (orígenes del frontend, separados por coma) ---
|
||||
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
|
||||
ALLOWED_ORIGINS=http://localhost:8075
|
||||
|
||||
# --- Rate limiting y tamaño de petición ---
|
||||
RATE_LIMIT_REQUESTS=60
|
||||
|
||||
+2
-2
@@ -23,6 +23,6 @@ RUN mkdir -p /app/uploads && chown -R app:app /app/uploads
|
||||
|
||||
USER app
|
||||
|
||||
EXPOSE 8000
|
||||
EXPOSE 8074
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8074"]
|
||||
|
||||
@@ -10,7 +10,7 @@ class Settings(BaseSettings):
|
||||
api_prefix: str = ""
|
||||
api_key: str = Field(min_length=16)
|
||||
database_url: str = "postgresql+psycopg://genexamenes:genexamenes@localhost:5432/genexamenes"
|
||||
allowed_origins: str = "http://localhost:5173,http://localhost:3000"
|
||||
allowed_origins: str = "http://localhost:8075"
|
||||
rate_limit_requests: int = Field(default=60, ge=1)
|
||||
rate_limit_window_seconds: int = Field(default=60, ge=1)
|
||||
max_request_bytes: int = Field(default=1_048_576, ge=1_024)
|
||||
|
||||
+5
-5
@@ -6,13 +6,13 @@ services:
|
||||
- ./backend/.env
|
||||
environment:
|
||||
DATABASE_URL: postgresql+psycopg://genexamenes:genexamenes@db:5432/genexamenes
|
||||
# Sobrescribe backend/.env si aún tiene el puerto 3000 del frontend antiguo.
|
||||
ALLOWED_ORIGINS: http://localhost:5173,http://localhost:3000
|
||||
# Sobrescribe backend/.env con el puerto actual del frontend.
|
||||
ALLOWED_ORIGINS: http://localhost:8075
|
||||
LLM_BASE_URL:
|
||||
LLM_MODEL: qwen3.5:35b
|
||||
LLM_TIMEOUT_SECONDS: "180"
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8074:8074"
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
@@ -24,10 +24,10 @@ services:
|
||||
build:
|
||||
context: ./frontend
|
||||
args:
|
||||
VITE_API_URL: ${VITE_API_URL:-http://localhost:8000}
|
||||
VITE_API_URL: ${VITE_API_URL:-http://localhost:8074}
|
||||
VITE_GOOGLE_CLIENT_ID: ${VITE_GOOGLE_CLIENT_ID:-}
|
||||
ports:
|
||||
- "5173:80"
|
||||
- "8075:80"
|
||||
depends_on:
|
||||
- backend
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# URL base del backend (accesible desde el navegador)
|
||||
VITE_API_URL=http://localhost:8000
|
||||
VITE_API_URL=http://localhost:8074
|
||||
|
||||
# (Opcional) Client ID de Google para "Iniciar sesión con Google".
|
||||
# Debe coincidir con GOOGLE_CLIENT_ID del backend.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
ARG VITE_API_URL=http://localhost:8000
|
||||
ARG VITE_API_URL=http://localhost:8074
|
||||
ARG VITE_GOOGLE_CLIENT_ID=
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
|
||||
|
||||
+4
-4
@@ -25,20 +25,20 @@ src/
|
||||
|
||||
## Desarrollo local
|
||||
|
||||
Requisitos: Node 20+ y el backend corriendo en `http://localhost:8000`.
|
||||
Requisitos: Node 20+ y el backend corriendo en `http://localhost:8074`.
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
cp .env.example .env # ajusta VITE_API_URL si es necesario
|
||||
npm install
|
||||
npm run dev # http://localhost:5173
|
||||
npm run dev # http://localhost:8075
|
||||
```
|
||||
|
||||
## Variables de entorno
|
||||
|
||||
| Variable | Descripción |
|
||||
| ----------------------- | -------------------------------------------------------- |
|
||||
| `VITE_API_URL` | URL base del backend (por defecto `http://localhost:8000`). |
|
||||
| `VITE_API_URL` | URL base del backend (por defecto `http://localhost:8074`). |
|
||||
| `VITE_GOOGLE_CLIENT_ID` | (Opcional) Client ID de Google. Si está vacío, se oculta el botón de Google. |
|
||||
|
||||
> Las variables `VITE_*` se incrustan en el build, por lo que apuntan al backend
|
||||
@@ -54,7 +54,7 @@ npm run preview # sirve el build localmente
|
||||
## Docker
|
||||
|
||||
El `docker-compose.yml` de la raíz construye el frontend con un build multi-stage
|
||||
(Node → Nginx) y lo publica en `http://localhost:5173`:
|
||||
(Node → Nginx) y lo publica en `http://localhost:8075`:
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
|
||||
export const API_URL =
|
||||
import.meta.env.VITE_API_URL?.replace(/\/$/, "") || "http://localhost:8000";
|
||||
import.meta.env.VITE_API_URL?.replace(/\/$/, "") || "http://localhost:8074";
|
||||
|
||||
const TOKEN_KEY = "genex_token";
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
port: 8075,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user