const { exec } = require('child_process'); const express = require('express'); const compression = require('compression'); const path = require('path'); const app = express(); // Start Hugo build and watch for changes exec('hugo --watch', (error, stdout, stderr) => { if (error) { console.error(`Hugo error: ${error.message}`); return; } if (stderr) { console.error(`Hugo stderr: ${stderr}`); return; } console.log(`Hugo stdout: ${stdout}`); }); // Enable compression app.use(compression({ level: 9 })); // Serve static files app.use(express.static(path.join(__dirname, 'public'))); // Start the server const PORT = 3000; app.listen(PORT, () => { console.log(`Server with compression is running at http://localhost:${PORT}`); });