matrix.js
547 Bytes
const express = require('express');
const moment = require('moment');
const os = require('os');
const matrix = require('../../matrix');
const router = express.Router();
module.exports = router;
const pageIndex = (req, res) => {
matrix.ts = new Date();
matrix.start_time_from_now = moment(matrix.start_time).fromNow();
matrix.uptime_secs = process.uptime();
matrix.loadavg = os.loadavg();
matrix.workdir = process.cwd();
matrix.memory_usage = process.memoryUsage();
res.json(matrix);
};
router.all('/', pageIndex);