diff --git a/install/linux.sh b/install/linux.sh index e5dec61..7bf0801 100755 --- a/install/linux.sh +++ b/install/linux.sh @@ -317,19 +317,23 @@ print_summary() { echo " ✅ Installation terminée !" echo "========================================" echo "" - echo "📝 Prochaines étapes :" + echo "🚀 Démarrage rapide :" echo "" - echo "1. Démarrer le serveur :" - echo " cd $PROJECT_ROOT/server" - echo " npm run dev" + echo " # Mode développement (recommandé)" + echo " ./start.sh --dev" echo "" - echo "2. Démarrer le client (autre terminal) :" - echo " cd $PROJECT_ROOT/client" - echo " npm run dev" + echo " # Mode production" + echo " ./start.sh" echo "" - echo "3. Accéder à l'application :" + echo "📝 OU manuellement (deux terminaux) :" + echo "" + echo " Terminal 1 : cd $PROJECT_ROOT/server && npm run dev" + echo " Terminal 2 : cd $PROJECT_ROOT/client && npm run dev" + echo "" + echo "🌐 Accès après démarrage :" echo " • Développement local : http://localhost:5173" echo " • Depuis autre appareil (WiFi) : http://${NETWORK_IP}:5173" + echo " • Production : http://${NETWORK_IP}:3000" echo "" echo "💡 Configuration réseau :" echo " IP serveur détectée : ${NETWORK_IP}" diff --git a/install/macos.sh b/install/macos.sh index 614d789..69d5b92 100755 --- a/install/macos.sh +++ b/install/macos.sh @@ -82,7 +82,7 @@ echo "" # Installer dépendances serveur echo "📦 Installation dépendances serveur..." -cd ../server +cd ./server npm install echo -e "${GREEN}✅ Dépendances serveur installées${NC}" echo "" @@ -152,17 +152,23 @@ echo "" echo "==================================" echo -e "${GREEN}✅ Installation terminée !${NC}" echo "" -echo "📝 Prochaines étapes :" +echo "🚀 Démarrage rapide :" echo "" -echo " 1. Démarrer le serveur :" -echo " cd server && npm run dev" +echo " # Mode développement (recommandé)" +echo " ./start.sh --dev" echo "" -echo " 2. Démarrer le client (nouveau terminal) :" -echo " cd client && npm run dev" +echo " # Mode production" +echo " ./start.sh" echo "" -echo " 3. Accéder à l'application :" -echo " • Développement local : https://localhost:5173" -echo " • Depuis autre appareil (WiFi) : https://${NETWORK_IP}:5173" +echo "📝 OU manuellement (deux terminaux) :" +echo "" +echo " Terminal 1 : cd server && npm run dev" +echo " Terminal 2 : cd client && npm run dev" +echo "" +echo "🌐 Accès après démarrage :" +echo " • Développement local : https://localhost:5173" +echo " • Depuis autre appareil (WiFi) : https://${NETWORK_IP}:5173" +echo " • Production : http://${NETWORK_IP}:3000" echo "" echo "💡 Configuration réseau :" echo " IP serveur détectée : ${NETWORK_IP}" diff --git a/server/index.js b/server/index.js index b528f74..64f7341 100644 --- a/server/index.js +++ b/server/index.js @@ -187,6 +187,19 @@ app.use((req, res, next) => { next(); }); +// ========== Servir fichiers statiques client (production) ========== + +// En production, servir le build client depuis ../client/dist +import { existsSync } from 'fs'; +const clientDistPath = join(__dirname, '..', 'client', 'dist'); + +if (existsSync(clientDistPath)) { + log('info', `📦 Serveur statique activé : ${clientDistPath}`); + app.use(express.static(clientDistPath)); +} else { + log('debug', '📦 Pas de build client (mode dev)'); +} + // ========== Routes Admin ========== // Monter les routes admin sous /admin @@ -331,20 +344,28 @@ app.get('/health', (req, res) => { /** * GET / - * Info serveur + * Info serveur OU client PWA (si build existe) */ app.get('/', (req, res) => { - res.json({ - name: 'PTT Live Server', - version: '0.1.0', - phase: 'Phase 1 - MVP', - endpoints: [ - 'GET /config - Configuration groupes', - 'GET /groups - Liste des groupes', - 'POST /token - Générer token client', - 'GET /health - Health check' - ] - }); + // Si build client existe, servir index.html + const indexPath = join(clientDistPath, 'index.html'); + if (existsSync(indexPath)) { + res.sendFile(indexPath); + } else { + // Sinon, afficher info API + res.json({ + name: 'PTT Live Server', + version: '0.2.0', + mode: 'development', + endpoints: [ + 'GET /config - Configuration groupes', + 'GET /groups - Liste des groupes', + 'POST /token - Générer token client', + 'GET /health - Health check', + 'GET /admin - Interface administration' + ] + }); + } }); // ========== Démarrage ==========