salomonsky commited on
Commit
e9ca083
·
verified ·
1 Parent(s): 4bd2778

Update server.mjs

Browse files
Files changed (1) hide show
  1. server.mjs +1 -6
server.mjs CHANGED
@@ -5,27 +5,22 @@ import fs from 'fs';
5
 
6
  const __filename = fileURLToPath(import.meta.url);
7
  const __dirname = path.dirname(__filename);
8
-
9
- // Puerto estándar de Hugging Face
10
  const PORT = process.env.PORT || 7860;
11
 
12
  const app = express();
13
  const distPath = path.join(__dirname, 'dist');
14
 
15
- // Diagnóstico de arranque
16
  console.log("--- Iniciando Servidor CoinTube ---");
17
  if (fs.existsSync(distPath)) {
18
  console.log(`✅ Carpeta 'dist' encontrada.`);
19
  const files = fs.readdirSync(distPath);
20
  console.log(`📄 Archivos en raíz: ${files.join(', ')}`);
21
  } else {
22
- console.error(`❌ ERROR CRÍTICO: No se encuentra la carpeta 'dist'. Vite no construyó la app correctamente.`);
23
  }
24
 
25
- // Servir archivos estáticos
26
  app.use(express.static(distPath));
27
 
28
- // Manejar SPA (Single Page Application)
29
  app.get('*', (req, res) => {
30
  const indexPath = path.join(distPath, 'index.html');
31
  if (fs.existsSync(indexPath)) {
 
5
 
6
  const __filename = fileURLToPath(import.meta.url);
7
  const __dirname = path.dirname(__filename);
 
 
8
  const PORT = process.env.PORT || 7860;
9
 
10
  const app = express();
11
  const distPath = path.join(__dirname, 'dist');
12
 
 
13
  console.log("--- Iniciando Servidor CoinTube ---");
14
  if (fs.existsSync(distPath)) {
15
  console.log(`✅ Carpeta 'dist' encontrada.`);
16
  const files = fs.readdirSync(distPath);
17
  console.log(`📄 Archivos en raíz: ${files.join(', ')}`);
18
  } else {
19
+ console.error(`❌ ERROR CRÍTICO: No se encuentra la carpeta 'dist'. Vite no construyó la app.`);
20
  }
21
 
 
22
  app.use(express.static(distPath));
23
 
 
24
  app.get('*', (req, res) => {
25
  const indexPath = path.join(distPath, 'index.html');
26
  if (fs.existsSync(indexPath)) {