// FLUJOS_APP_PRUEBAS.js // Servidor ligero para probar los demos de visualización SIN necesitar MongoDB. // No modifica ni interfiere con FLUJOS_APP.js. // Arrancarlo: node FLUJOS_APP_PRUEBAS.js // URL: http://localhost:3001/demos/demo_text_nodes.html const express = require('express'); const path = require('path'); const helmet = require('helmet'); const app = express(); const PORT = 3001; // CSP ampliada para permitir esm.sh (demos usan ES modules desde CDN) app.use( helmet.contentSecurityPolicy({ directives: { defaultSrc: ["'self'"], scriptSrc: [ "'self'", "'unsafe-inline'", "'unsafe-eval'", 'https://unpkg.com', 'https://cdnjs.cloudflare.com', 'https://fonts.googleapis.com', 'https://esm.sh', ], scriptSrcElem: [ "'self'", "'unsafe-inline'", 'https://unpkg.com', 'https://cdnjs.cloudflare.com', 'https://esm.sh', ], styleSrc: ["'self'", "'unsafe-inline'", 'https://fonts.googleapis.com'], fontSrc: ["'self'", 'https://fonts.gstatic.com', 'https://fonts.googleapis.com'], imgSrc: ["'self'", 'data:', 'blob:'], connectSrc: ["'self'", 'https://esm.sh', 'ws://localhost:3001'], workerSrc: ["'self'", 'blob:'], scriptSrcAttr: ["'unsafe-inline'"], }, }) ); // Ruta raíz → index de demos (debe ir ANTES del middleware estático) app.get('/', (req, res) => { res.send(` FLUJOS — Demos

FLUJOS · DEMOS

Servidor de pruebas — sin MongoDB · puerto 3001

`); }); // Archivos estáticos (después de la ruta raíz) app.use(express.static(path.join(__dirname, '../VISUALIZACION/public'))); app.listen(PORT, '0.0.0.0', () => { console.log(`\n FLUJOS PRUEBAS corriendo en http://localhost:${PORT}`); console.log(` Demos disponibles:`); console.log(` http://localhost:${PORT}/demos/demo_text_nodes.html`); console.log(` http://localhost:${PORT}/demos/demo_img_nodes.html`); console.log(` http://localhost:${PORT}/demos/demo_mixed_nodes.html\n`); });