backend/src/services/stats.services.js

25 lines
803 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', 'info');
var dat = db.query('meta', {target: 'counters'});
var ver = db.query('meta', {target: 'versions'});
log.out('statsServices.hits: fetched server meta', 'info');
let out = {};
out.host = os.hostname();
// eslint-disable-next-line no-undef
out.mode = process.env.NODE_ENV;
out.verBkend = vers.app;
out.verApi = vers.api;
out.dat = await dat;
out.ver = await ver;
log.out(`statsServices.hits: Sending Data: ${JSON.stringify(out)}`, 'info');
return out;
}
module.exports = {
hits
};