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:
+12
-8
@@ -317,19 +317,23 @@ print_summary() {
|
|||||||
echo " ✅ Installation terminée !"
|
echo " ✅ Installation terminée !"
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo ""
|
echo ""
|
||||||
echo "📝 Prochaines étapes :"
|
echo "🚀 Démarrage rapide :"
|
||||||
echo ""
|
echo ""
|
||||||
echo "1. Démarrer le serveur :"
|
echo " # Mode développement (recommandé)"
|
||||||
echo " cd $PROJECT_ROOT/server"
|
echo " ./start.sh --dev"
|
||||||
echo " npm run dev"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "2. Démarrer le client (autre terminal) :"
|
echo " # Mode production"
|
||||||
echo " cd $PROJECT_ROOT/client"
|
echo " ./start.sh"
|
||||||
echo " npm run dev"
|
|
||||||
echo ""
|
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 " • Développement local : http://localhost:5173"
|
||||||
echo " • Depuis autre appareil (WiFi) : http://${NETWORK_IP}:5173"
|
echo " • Depuis autre appareil (WiFi) : http://${NETWORK_IP}:5173"
|
||||||
|
echo " • Production : http://${NETWORK_IP}:3000"
|
||||||
echo ""
|
echo ""
|
||||||
echo "💡 Configuration réseau :"
|
echo "💡 Configuration réseau :"
|
||||||
echo " IP serveur détectée : ${NETWORK_IP}"
|
echo " IP serveur détectée : ${NETWORK_IP}"
|
||||||
|
|||||||
+15
-9
@@ -82,7 +82,7 @@ echo ""
|
|||||||
|
|
||||||
# Installer dépendances serveur
|
# Installer dépendances serveur
|
||||||
echo "📦 Installation dépendances serveur..."
|
echo "📦 Installation dépendances serveur..."
|
||||||
cd ../server
|
cd ./server
|
||||||
npm install
|
npm install
|
||||||
echo -e "${GREEN}✅ Dépendances serveur installées${NC}"
|
echo -e "${GREEN}✅ Dépendances serveur installées${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -152,17 +152,23 @@ echo ""
|
|||||||
echo "=================================="
|
echo "=================================="
|
||||||
echo -e "${GREEN}✅ Installation terminée !${NC}"
|
echo -e "${GREEN}✅ Installation terminée !${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
echo "📝 Prochaines étapes :"
|
echo "🚀 Démarrage rapide :"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 1. Démarrer le serveur :"
|
echo " # Mode développement (recommandé)"
|
||||||
echo " cd server && npm run dev"
|
echo " ./start.sh --dev"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 2. Démarrer le client (nouveau terminal) :"
|
echo " # Mode production"
|
||||||
echo " cd client && npm run dev"
|
echo " ./start.sh"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 3. Accéder à l'application :"
|
echo "📝 OU manuellement (deux terminaux) :"
|
||||||
echo " • Développement local : https://localhost:5173"
|
echo ""
|
||||||
echo " • Depuis autre appareil (WiFi) : https://${NETWORK_IP}:5173"
|
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 ""
|
||||||
echo "💡 Configuration réseau :"
|
echo "💡 Configuration réseau :"
|
||||||
echo " IP serveur détectée : ${NETWORK_IP}"
|
echo " IP serveur détectée : ${NETWORK_IP}"
|
||||||
|
|||||||
+33
-12
@@ -187,6 +187,19 @@ app.use((req, res, next) => {
|
|||||||
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 ==========
|
// ========== Routes Admin ==========
|
||||||
|
|
||||||
// Monter les routes admin sous /admin
|
// Monter les routes admin sous /admin
|
||||||
@@ -331,20 +344,28 @@ app.get('/health', (req, res) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /
|
* GET /
|
||||||
* Info serveur
|
* Info serveur OU client PWA (si build existe)
|
||||||
*/
|
*/
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.json({
|
// Si build client existe, servir index.html
|
||||||
name: 'PTT Live Server',
|
const indexPath = join(clientDistPath, 'index.html');
|
||||||
version: '0.1.0',
|
if (existsSync(indexPath)) {
|
||||||
phase: 'Phase 1 - MVP',
|
res.sendFile(indexPath);
|
||||||
endpoints: [
|
} else {
|
||||||
'GET /config - Configuration groupes',
|
// Sinon, afficher info API
|
||||||
'GET /groups - Liste des groupes',
|
res.json({
|
||||||
'POST /token - Générer token client',
|
name: 'PTT Live Server',
|
||||||
'GET /health - Health check'
|
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 ==========
|
// ========== Démarrage ==========
|
||||||
|
|||||||
Reference in New Issue
Block a user