neues docker-compose für Profuktion und Anpassungen
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user