Api endpoint added /api/latency-targets
All checks were successful
Docker / build-and-push (push) Successful in 1m48s

This commit is contained in:
Fredrik Johansson
2026-07-26 18:48:39 +02:00
parent 3adf06e4e1
commit e146126f86
3 changed files with 29 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ async function refreshNpmHosts(): Promise<void> {
}
}
function currentTargets(): CheckTarget[] {
export function currentTargets(): CheckTarget[] {
return computeTargets(rawHosts, getAllOverrides(), listManualTargets());
}

View File

@@ -1,6 +1,6 @@
import express from 'express';
import { config } from './config.js';
import { startChecker, getStore } from './checker.js';
import { startChecker, getStore, currentTargets } from './checker.js';
import { renderPage } from './page.js';
import { renderAdminPage } from './adminPage.js';
import { router as adminRouter } from './admin.js';
@@ -13,6 +13,13 @@ app.get('/api/status', (_req, res) => {
res.json(getStore());
});
app.get('/api/latency-targets', (_req, res) => {
res.json({
refreshedAt: new Date().toISOString(),
targets: currentTargets(),
});
});
app.use('/api/admin', adminRouter);
app.get('/admin', (_req, res) => {