neues docker-compose für Profuktion und Anpassungen

This commit is contained in:
rxf
2026-02-10 20:22:44 +01:00
parent f32e472ea3
commit 4fde7ed46a
4 changed files with 292 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ server {
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json;
# API proxy
# API proxy (wird im Docker-Compose-Netzwerk aufgelöst)
location /api/ {
proxy_pass http://api:8000/;
proxy_http_version 1.1;

View File

@@ -17,8 +17,14 @@ function App() {
setLastUpdate(new Date())
setLoading(false)
} else {
// Entwicklungsmodus: Daten von API holen
const response = await fetch('http://localhost:8000/weather/history?hours=24')
// Development oder Production: Daten von API holen
// Im Development: localhost:8000
// Im Production: /api/ (nginx proxy)
const apiUrl = import.meta.env.DEV
? 'http://localhost:8000/weather/history?hours=24'
: '/api/weather/history?hours=24'
const response = await fetch(apiUrl)
if (!response.ok) {
throw new Error('API-Fehler: ' + response.status)
}