backend/src/services/stats.services.js

23 lines
734 B
JavaScript
Raw Normal View History

const log = require('../utils/log.utils'); // Log Helper
const db = require('../services/dbAccess.services')
const os = require('os')
const vers = require('../configs/version.configs')
async function hits(){
log.out("statsServices.hits: Statistics Requested")
var dat = db.query("meta", {target: "counters"});
var ver = db.query("meta", {target: "versions"});
log.out(`statsServices.hits: fetched server meta`)
let out = {};
out.host = os.hostname();
out.mode = process.env.NODE_ENV;
out.verBkend = vers.app;
out.dat = await dat;
out.ver = await ver;
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`)
return out;
}
module.exports = {
hits
}