fix: messages installation et serveur statique production

1. Messages finaux install scripts
   - Mise en avant de ./start.sh (recommandé)
   - Méthode manuelle en alternatif
   - Port production corrigé (3000 au lieu de 5173)

2. Serveur statique production (server/index.js)
   - Sert client/dist/ si build existe
   - Route / serve index.html en production
   - Mode dev : retourne info API JSON
   - Permet ./start.sh mode prod fonctionnel

Fix issues identifiés : messages obsolètes + production non fonctionnelle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-27 14:39:02 +02:00
parent 1050369469
commit 79cda9653b
3 changed files with 60 additions and 29 deletions
+12 -8
View File
@@ -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}"
+15 -9
View File
@@ -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}"
+33 -12
View File
@@ -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 ==========