mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Refactored server to handle new JSON post requests
This commit is contained in:
parent
0f71d6705b
commit
3c0e593ed4
3 changed files with 284 additions and 24 deletions
9
utils.js
9
utils.js
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue