Enable CORS for dashboard

هذا الالتزام موجود في:
2026-07-28 18:29:19 +00:00
الأصل 5e49b44bca
التزام 8fcc265189
5 ملفات معدلة مع 184 إضافات و2 حذوفات

67
dashboard/script.js Normal file
عرض الملف

@@ -0,0 +1,67 @@
const API_URL =
"https://ghaymah-sre-api-20e343cababc.hosted.ghaymah.systems";
async function checkApplication(){
try {
let start = Date.now();
let healthResponse =
await fetch(API_URL + "/health");
let end = Date.now();
let responseTime =
end - start;
let statsResponse =
await fetch(API_URL + "/stats");
let stats =
await statsResponse.json();
document.getElementById("status").innerHTML =
healthResponse.ok ? "UP" : "DOWN";
document.getElementById("response").innerHTML =
responseTime + " ms";
document.getElementById("requests").innerHTML =
stats.requests;
}
catch(error){
document.getElementById("status").innerHTML =
"DOWN";
console.log(error);
}
}
checkApplication();
setInterval(
checkApplication,
30000
);