Add api endpoint for stats #6

Merged
tgpholly merged 3 commits from add-stats-api into master 2020-02-20 08:03:10 +00:00
Showing only changes of commit 9e23c68204 - Show all commits

7
EUS.js
View file

@ -60,13 +60,10 @@ fs.access(`${__dirname}${BASE_PATH}/config.json`, error => {
process.exit(0); process.exit(0);
}); });
} else { } else {
eusConfig = require(`${__dirname}${BASE_PATH}/image-type.json`); eusConfig = require(`${__dirname}${BASE_PATH}/config.json`);
} }
}); });
// Construct the full exported url from the config string and port using javascript magic
const exportURL = `${eusConfig.baseURL}:${config.server.port}/`;
module.exports = { module.exports = {
extras:function() { extras:function() {
// Setup express to use busboy // Setup express to use busboy
@ -158,7 +155,7 @@ module.exports = {
if (err) throw err; if (err) throw err;
global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: Upload of ${fileOutName} finished. Took ${endTime - startTime}ms`); global.modules.consoleHelper.printInfo(emoji.heavy_check, `${req.method}: Upload of ${fileOutName} finished. Took ${endTime - startTime}ms`);
// Send URL of the uploaded image to the client // Send URL of the uploaded image to the client
res.end(exportURL+""+fileOutName); res.end(eusConfig.baseURL+""+fileOutName);
}); });
}); });
}); });