mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2026-04-28 03:07:38 +02:00
Refactored server to handle new JSON post requests
This commit is contained in:
@@ -15,6 +15,7 @@ const recievedFile = "stats/recieved";
|
||||
const staticFile = "public/data/static";
|
||||
const manFile = "public/man.html";
|
||||
const logFile = "stats/logs";
|
||||
const dataFile = "public/data.json";
|
||||
|
||||
function ReadFile(name) {
|
||||
return fs.readFileSync(name, "utf8");
|
||||
@@ -56,4 +57,12 @@ function WriteBackup() {
|
||||
logger.Log("[ERR ]: Error backing up recieved file!", logger.GetColor("redbg"));
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
try {
|
||||
WriteFileAsync(ReadFile(dataFile), 'public/backs/data_' + new Date().toString());
|
||||
|
||||
} catch (e) {
|
||||
logger.Log("[ERR ]: Error backing up data json file!", logger.GetColor("redbg"));
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user