const fs = require('fs'); const path = require('path'); global.marked = require('marked'); //note: this is used in other files require('dotenv').config(); // Load environment variables from .env file const express = require('express'); global.app = express(); const PORT = process.env.PORT || 3000; // Specify the folder containing the .js files const folderPath = './addon-scripts'; // Change this to your folder path // Read the directory fs.readdir(folderPath, (err, files) => { if (err) { console.error('Error reading directory:', err); return; } // Filter for .js files const jsFiles = files.filter(file => path.extname(file) === '.js'); // Read and evaluate each .js file jsFiles.forEach(file => { const filePath = path.join(folderPath, file); fs.readFile(filePath, 'utf8', (err, data) => { if (err) { console.error(`Error reading file ${file}:`, err); return; } try { Function(data)() } catch (e) { console.error(`Error executing ${file}:`, e); } }); }); }); app.listen(PORT, () => { console.log(`Website server is running on port ${PORT}`); });