# 🔄 Changements - Port 4400 et Script run.sh ## RĂ©sumĂ© des modifications ✅ **Port frontend changĂ©** : 3000 → 4400 ✅ **Nouveau script** : `run.sh` (complet avec vĂ©rifications) ✅ **Script existant** : `start_web.sh` (mis Ă  jour) ✅ **CORS** : Ajout du port 4400 ✅ **Documentation** : Mise Ă  jour --- ## Fichiers modifiĂ©s ### 1. Frontend - Port 4400 **`frontend/vite.config.js`** : ```javascript server: { port: 4400, // ChangĂ© de 3000 Ă  4400 ... } ``` **`frontend/src/api/client.js`** : ```javascript const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000/api' // Maintenant configurable via variable d'environnement ``` ### 2. Backend - CORS **`src/api/main.py`** : ```python allow_origins=[ "http://localhost:4400", # Nouveau port "http://localhost:3000", # Ancien port (rĂ©trocompatibilitĂ©) "http://localhost:5173" # Port Vite alternatif ] ``` ### 3. Scripts **`run.sh`** (NOUVEAU) : - Script complet avec vĂ©rifications - Messages colorĂ©s - Logs dans fichiers - Gestion d'erreurs avancĂ©e - ArrĂȘt propre **`start_web.sh`** (MODIFIÉ) : - Port frontend mis Ă  jour : 4400 - Reste simple et rapide ### 4. Configuration **`frontend/.env.example`** (NOUVEAU) : ```bash VITE_API_URL=http://localhost:8000/api ``` ### 5. Documentation **Fichiers mis Ă  jour** : - `START_HERE.md` - Port 4400 + nouveau script - `QUICK_START_WEB.md` - À mettre Ă  jour - `README_WEB_INTERFACE.md` - À mettre Ă  jour **Nouveau fichier** : - `RUN_SCRIPT_GUIDE.md` - Guide complet du script run.sh --- ## Nouveaux ports | Service | Ancien Port | Nouveau Port | URL | |---------|-------------|--------------|-----| | Frontend | 3000 | **4400** | http://localhost:4400 | | API | 8000 | 8000 | http://localhost:8000 | | Docs API | 8000 | 8000 | http://localhost:8000/docs | --- ## Utilisation ### Option 1 : Script complet (recommandĂ©) ```bash cd omop ./run.sh ``` **Avantages** : - ✅ VĂ©rifications complĂštes (Python, Node, PostgreSQL) - ✅ Installation automatique des dĂ©pendances - ✅ Messages colorĂ©s et clairs - ✅ Logs dans fichiers (`logs/api.log`, `logs/frontend.log`) - ✅ Gestion d'erreurs avancĂ©e - ✅ ArrĂȘt propre avec Ctrl+C ### Option 2 : Script simple ```bash cd omop ./start_web.sh ``` **Avantages** : - ✅ DĂ©marrage rapide - ✅ Simple et lĂ©ger - ✅ Installation automatique des dĂ©pendances --- ## AccĂšs Ă  l'interface **Nouvelle URL** : http://localhost:4400 **Ancienne URL** : ~~http://localhost:3000~~ (ne fonctionne plus) --- ## Migration Si tu utilisais l'ancien port 3000 : 1. **Aucune action requise** - Le port a changĂ© automatiquement 2. **Mets Ă  jour tes bookmarks** : http://localhost:4400 3. **Utilise le nouveau script** : `./run.sh` --- ## VĂ©rification Pour vĂ©rifier que tout fonctionne : ```bash # 1. Lancer la stack ./run.sh # 2. VĂ©rifier l'API curl http://localhost:8000/health # 3. VĂ©rifier le frontend curl http://localhost:4400 # 4. Ouvrir dans le navigateur xdg-open http://localhost:4400 # Linux open http://localhost:4400 # macOS ``` --- ## Logs Les logs sont maintenant dans des fichiers : ```bash # Logs API tail -f logs/api.log # Logs Frontend tail -f logs/frontend.log ``` --- ## Troubleshooting ### Port 4400 dĂ©jĂ  utilisĂ© ```bash # Trouver le processus lsof -i :4400 # Tuer le processus kill -9 ``` ### Erreur CORS Si tu as des erreurs CORS, vĂ©rifie que `src/api/main.py` contient : ```python allow_origins=["http://localhost:4400", ...] ``` ### Le frontend ne dĂ©marre pas ```bash # RĂ©installer les dĂ©pendances cd frontend rm -rf node_modules package-lock.json npm install ``` --- ## RĂ©trocompatibilitĂ© Le backend accepte toujours les requĂȘtes depuis : - ✅ http://localhost:4400 (nouveau) - ✅ http://localhost:3000 (ancien) - ✅ http://localhost:5173 (Vite alternatif) Mais le frontend ne dĂ©marre plus sur le port 3000. --- ## RĂ©sumĂ© des changements | ÉlĂ©ment | Avant | AprĂšs | |---------|-------|-------| | Port frontend | 3000 | **4400** | | Script principal | `start_web.sh` | `run.sh` (nouveau) | | Logs | Console | Fichiers (`logs/*.log`) | | VĂ©rifications | Basiques | ComplĂštes | | Messages | Simples | ColorĂ©s | | CORS | Port 3000 | Ports 3000, 4400, 5173 | --- ## Documentation **Nouveau guide** : `RUN_SCRIPT_GUIDE.md` - Guide complet du script `run.sh` - Troubleshooting dĂ©taillĂ© - Exemples d'utilisation **Fichiers mis Ă  jour** : - `START_HERE.md` - Port 4400 - `frontend/vite.config.js` - Port 4400 - `src/api/main.py` - CORS port 4400 - `start_web.sh` - Port 4400 --- ## Commandes rapides ```bash # DĂ©marrer (recommandĂ©) ./run.sh # DĂ©marrer (simple) ./start_web.sh # ArrĂȘter Ctrl+C # Consulter les logs tail -f logs/api.log tail -f logs/frontend.log # AccĂ©der Ă  l'interface http://localhost:4400 ``` --- ## ✅ Checklist de migration - [x] Port frontend changĂ© : 4400 - [x] Script `run.sh` créé - [x] Script `start_web.sh` mis Ă  jour - [x] CORS mis Ă  jour - [x] Documentation mise Ă  jour - [x] Guide `RUN_SCRIPT_GUIDE.md` créé - [x] Fichier `.env.example` créé - [x] RĂ©trocompatibilitĂ© CORS maintenue **Tout est prĂȘt ! 🚀** --- ## Prochaines Ă©tapes 1. **Teste le nouveau script** : `./run.sh` 2. **Ouvre l'interface** : http://localhost:4400 3. **Consulte le guide** : `RUN_SCRIPT_GUIDE.md` 4. **Mets Ă  jour tes bookmarks** : Port 4400 **Bon dĂ©veloppement ! 🎉**