Update v1.0.0-beta.12, addition of external APIs and optimization
Some checks failed
continuous-integration/drone/push Build was killed
continuous-integration/drone Build was killed

This commit is contained in:
2024-05-28 20:20:52 +02:00
parent b48abc756d
commit d76a781680
19 changed files with 742 additions and 169 deletions

View File

@@ -12,6 +12,7 @@ const fs = require('fs');
const SystemReport = require('./models/reportManager.js');
const routes = require('./routes/routes.js');
const cron = require('node-cron');
const chalk = require('chalk');
require('dotenv').config();
const app = express();
@@ -110,8 +111,33 @@ async function fileExists(filePath) {
}
}
function getAllFiles(dirPath, arrayOfFiles) {
const files = fs.readdirSync(dirPath);
arrayOfFiles = arrayOfFiles || [];
files.forEach(function(file) {
if (fs.statSync(dirPath + "/" + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles);
} else {
arrayOfFiles.push(path.join(dirPath, "/", file));
}
});
return arrayOfFiles;
}
const allFiles = getAllFiles(__dirname);
const PORT = process.env.PORT || 5053;
app.listen(PORT, () => {
allFiles.forEach(file => {
console.log(`[ ${chalk.green('OK')} ] Loaded file: ${file}`);
});
console.clear();
if (logger) {
logger.info(`☀️ Welcome to the Content Delivery Network (CDN) Server`);