// 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(`
Servidor de pruebas — sin MongoDB · puerto 3001