convert index.js to tabs (4) instead of spaces
This commit is contained in:
parent
0f6828d44b
commit
53bf425bd3
1 changed files with 107 additions and 111 deletions
26
index.js
26
index.js
|
@ -1,7 +1,7 @@
|
||||||
const express = require("express"),
|
const express = require("express"),
|
||||||
fs = require("fs"),
|
fs = require("fs"),
|
||||||
chalk = require("chalk"),
|
chalk = require("chalk"),
|
||||||
emoji = require("./misc/emoji_list.json");
|
emoji = require("./misc/emoji_list.json");
|
||||||
// This is a class that contains the name and status of required modules
|
// This is a class that contains the name and status of required modules
|
||||||
class reqMod {
|
class reqMod {
|
||||||
constructor(name, status) {
|
constructor(name, status) {
|
||||||
|
@ -9,7 +9,7 @@ class reqMod {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Array containing a list of required modules and their flags
|
// List containing a list of required modules and their flags
|
||||||
const requiredModules = [
|
const requiredModules = [
|
||||||
new reqMod("handle_console", false)
|
new reqMod("handle_console", false)
|
||||||
];
|
];
|
||||||
|
@ -22,7 +22,7 @@ if (fs.existsSync("./config/config.json")) {
|
||||||
} else {
|
} else {
|
||||||
console.log("[Config] Config file doesn't exist! You probably haven't copied the example config in the config directory.");
|
console.log("[Config] Config file doesn't exist! You probably haven't copied the example config in the config directory.");
|
||||||
console.log("[Config] Exiting...");
|
console.log("[Config] Exiting...");
|
||||||
// It doesn't exist, exit the framework and tell the user what to do
|
// It doesn't exist, exit Revolution and tell the user what to do
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
global.actualDir = __dirname;
|
global.actualDir = __dirname;
|
||||||
|
@ -31,10 +31,8 @@ global.internals = {
|
||||||
};
|
};
|
||||||
global.app = express();
|
global.app = express();
|
||||||
global.modules = [];
|
global.modules = [];
|
||||||
let dE = new Date(),
|
|
||||||
// Get the time at invocation
|
// Get the time at invocation
|
||||||
startTime = dE.getTime(),
|
let startTime = Date.now(),
|
||||||
endTime,
|
|
||||||
reqhandler;
|
reqhandler;
|
||||||
|
|
||||||
// Clear console before printing anything
|
// Clear console before printing anything
|
||||||
|
@ -52,7 +50,7 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
/*
|
/*
|
||||||
For every file in the array, output that it was found
|
For every file in the list, output that it was found
|
||||||
in the console and attempt to load it using require.
|
in the console and attempt to load it using require.
|
||||||
Oh, and check that it has .js in it's file name!
|
Oh, and check that it has .js in it's file name!
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +89,7 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
|
||||||
// Check if all the required modules flags are set
|
// Check if all the required modules flags are set
|
||||||
let allRequiredExist = [];
|
let allRequiredExist = [];
|
||||||
for (var i = 0; i < requiredModules.length; i++) {
|
for (var i = 0; i < requiredModules.length; i++) {
|
||||||
// Push the status of the required modules to an array
|
// Push the status of the required modules to an list
|
||||||
allRequiredExist.push(requiredModules[i].status);
|
allRequiredExist.push(requiredModules[i].status);
|
||||||
}
|
}
|
||||||
// Make sure all required modules are found
|
// Make sure all required modules are found
|
||||||
|
@ -99,10 +97,10 @@ fs.readFile('./misc/ascii.txt', function(err, data) {
|
||||||
// Inform the user that not all required modules are found.
|
// Inform the user that not all required modules are found.
|
||||||
console.log("[Modules] All required modules could not be found.");
|
console.log("[Modules] All required modules could not be found.");
|
||||||
console.log("[Modules] Server will not start until all required modules are found.");
|
console.log("[Modules] Server will not start until all required modules are found.");
|
||||||
// They are not all found, exit framework with code 1.
|
// They are not all found, exit Revolution with code 1.
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
} else {
|
} else {
|
||||||
// All required modules are found, start the framework's server.
|
// All required modules are found, start Revolution's server.
|
||||||
global.modules.consoleHelper.printInfo(emoji.wave, "Starting Revolution...");
|
global.modules.consoleHelper.printInfo(emoji.wave, "Starting Revolution...");
|
||||||
if (reqhandler == null) {
|
if (reqhandler == null) {
|
||||||
global.modules.consoleHelper.printError(emoji.cross, "No request handler was loaded, possibly due to an error.");
|
global.modules.consoleHelper.printError(emoji.cross, "No request handler was loaded, possibly due to an error.");
|
||||||
|
@ -128,10 +126,8 @@ async function start() {
|
||||||
});
|
});
|
||||||
// Start the server listening at the port defined in the config file
|
// Start the server listening at the port defined in the config file
|
||||||
app.listen(config.server.port, () => {
|
app.listen(config.server.port, () => {
|
||||||
dE = new Date(),
|
|
||||||
// Get time after server has started listening or the "end time".
|
// Get time after server has started listening or the "end time".
|
||||||
endTime = dE.getTime();
|
global.modules.consoleHelper.printInfo(emoji.thumb_up, `Started Revolution on port ${config.server.port}! Took ${Date.now() - startTime}ms`);
|
||||||
global.modules.consoleHelper.printInfo(emoji.thumb_up, `Started Revolution on port ${config.server.port}! Took ${endTime - startTime}ms`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue