feat: load version.json at startup, expose via /api/health
This commit is contained in:
13
server.js
13
server.js
@@ -29,8 +29,19 @@ function audit(action, entityType, entityId, performedBy, details) {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Version info (written by Dockerfile at build time) ───────────────────────
|
||||
// Falls back to { sha: 'dev' } when running outside a Docker build (local dev).
|
||||
let BUILD_VERSION = { sha: 'dev', shortSha: 'dev', buildTime: null };
|
||||
try {
|
||||
BUILD_VERSION = require('./client/dist/version.json');
|
||||
} catch (_) { /* pre-build or local dev — stub values are fine */ }
|
||||
|
||||
// Health
|
||||
app.get('/api/health', (req, res) => res.json({ status: 'ok', timestamp: new Date().toISOString() }));
|
||||
app.get('/api/health', (req, res) => res.json({
|
||||
status: 'ok',
|
||||
timestamp: new Date().toISOString(),
|
||||
version: BUILD_VERSION,
|
||||
}));
|
||||
|
||||
// ── Employees ────────────────────────────────────────────────────────────────
|
||||
app.get('/api/employees', (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user