Add comments to the framework & included modules #16

Merged
tgpholly merged 9 commits from add-comments into master 2020-01-04 15:18:13 +00:00
Showing only changes of commit 627d5846c4 - Show all commits

View file

@ -61,6 +61,13 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
if (files[i].includes(".js")) { if (files[i].includes(".js")) {
console.log(`[Modules] Found module ${files[i].toString()}`); console.log(`[Modules] Found module ${files[i].toString()}`);
global.modules[files[i].toString().replace(".js", "")] = require(`./modules/${files[i].toString()}`); global.modules[files[i].toString().replace(".js", "")] = require(`./modules/${files[i].toString()}`);
// We want to find out what the request handler module is
if (global.modules[files[i].toString().replace(".js", "")].MOD_FUNC == "handle_requests") {
// Set reqhandler to the request handler for easy getting
reqhandler = global.modules[files[i].toString().replace(".js", "")];
}
// Loop through and set the required modules flags // Loop through and set the required modules flags
for (var i1 = 0; i1 < requiredModules.length; i1++) { for (var i1 = 0; i1 < requiredModules.length; i1++) {
// Check if this module is a required module // Check if this module is a required module
@ -69,11 +76,6 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
requiredModules[i1].status = true; requiredModules[i1].status = true;
} }
} }
// We want to find out what the request handler module is
if (global.modules[files[i].toString().replace(".js", "")].MOD_FUNC == "handle_requests") {
// Set reqhandler to the request handler for easy getting
reqhandler = global.modules[files[i].toString().replace(".js", "")];
}
} else { } else {
// File is not a .js file (module) // File is not a .js file (module)
// Make sure the file is not a directory // Make sure the file is not a directory
@ -102,7 +104,7 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
} else { } else {
// All required modules are found, start the framework's server. // All required modules are found, start the framework's server.
global.modules.consoleHelper.printInfo(emoji.wave, "Starting Revolution..."); global.modules.consoleHelper.printInfo(emoji.wave, "Starting Revolution...");
server(); frameworkServer();
} }
}); });
}); });