Add server status monitoring endpoint

- Add status.service.js with CPU, RAM, Disk, Backend stats
- RAM calculation matches htop (reads /proc/meminfo)
- Includes uploads folder size, DB table count
- Returns both system and backend (process) uptime

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
richardtekula
2025-12-05 09:00:31 +01:00
parent eb5582feb6
commit 03b7a215bb
3 changed files with 211 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
import * as adminService from '../services/admin.service.js';
import * as statusService from '../services/status.service.js';
import { logUserCreation, logRoleChange } from '../services/audit.service.js';
/**
@@ -142,3 +143,20 @@ export const deleteUser = async (req, res, next) => {
return next(error);
}
};
/**
* Get server status (admin only)
* GET /api/admin/server-status
*/
export const getServerStatus = async (req, res, next) => {
try {
const status = await statusService.getServerStatus();
res.status(200).json({
success: true,
data: status,
});
} catch (error) {
return next(error);
}
};