87 lines
2.0 KiB
Markdown
87 lines
2.0 KiB
Markdown
# 🚀 Quick Start - Lokaler Reverse Proxy
|
|
|
|
## Sofort loslegen
|
|
|
|
### Terminal 1: Proxy Server starten
|
|
|
|
```bash
|
|
./start-proxy.sh
|
|
```
|
|
|
|
Oder manuell:
|
|
```bash
|
|
cd proxy-server
|
|
node server.js
|
|
```
|
|
|
|
### Terminal 2: Flutter App starten
|
|
|
|
```bash
|
|
flutter run -d chrome
|
|
```
|
|
|
|
## ✅ Das wars!
|
|
|
|
Die App verwendet jetzt automatisch den lokalen Proxy auf `http://localhost:3000` für Geocoding.
|
|
|
|
## 🔧 Konfiguration
|
|
|
|
In [lib/config/environment.dart](lib/config/environment.dart):
|
|
|
|
```dart
|
|
static const bool useLocalProxy = true; // true = Proxy, false = Appwrite Function
|
|
```
|
|
|
|
## 📋 Checkliste
|
|
|
|
- ✅ Node.js installiert (`node --version`)
|
|
- ✅ Proxy läuft (`http://localhost:3000` im Browser)
|
|
- ✅ `useLocalProxy = true` in environment.dart
|
|
- ✅ Flutter App läuft
|
|
|
|
## 🎯 Vorteile Lokaler Proxy
|
|
|
|
✅ **Kein CORS-Problem** - Server umgeht Browser-Beschränkungen
|
|
✅ **Schnelles Testen** - Kein Cloud-Deployment nötig
|
|
✅ **Einfaches Debugging** - Logs direkt im Terminal
|
|
✅ **Kostenlos** - Läuft lokal, keine Cloud-Kosten
|
|
|
|
## 🌐 Für Produktion
|
|
|
|
Für den Live-Betrieb:
|
|
|
|
1. Setzen Sie `useLocalProxy = false`
|
|
2. Deployen Sie die Appwrite Function (siehe [DEPLOYMENT.md](DEPLOYMENT.md))
|
|
3. Tragen Sie die Function ID ein
|
|
|
|
## 📊 Vergleich
|
|
|
|
| Feature | Lokaler Proxy | Appwrite Function |
|
|
|---------|--------------|-------------------|
|
|
| Setup Zeit | < 1 Minute | ~10 Minuten |
|
|
| CORS | ✅ Gelöst | ✅ Gelöst |
|
|
| Kosten | Kostenlos | Serverless (minimal) |
|
|
| Verwendung | Nur Entwicklung | Entwicklung + Produktion |
|
|
| Debugging | Sehr einfach | Logs in Console |
|
|
| Offline | ❌ | ❌ |
|
|
|
|
## 🐛 Problemlösung
|
|
|
|
**Proxy startet nicht:**
|
|
```bash
|
|
# Port 3000 belegt?
|
|
lsof -i :3000
|
|
# Prozess beenden
|
|
kill -9 <PID>
|
|
```
|
|
|
|
**App findet Proxy nicht:**
|
|
- Proxy läuft? Prüfen Sie `http://localhost:3000` im Browser
|
|
- `useLocalProxy = true`? Prüfen Sie environment.dart
|
|
- Hot Restart in Flutter machen
|
|
|
|
**Immer noch CORS-Fehler:**
|
|
- Browser-Cache leeren
|
|
- DevTools → Network → "Disable cache"
|
|
- App neu builden: `flutter run -d chrome`
|