Menu
Public repository / master
AkurAI-Framework / crates/cli/assets/app.js
Latest change efd5eb833824dca5c86104004c11bc6d39ff1a72 - feat(template): pure-std SSR template engine + component showcase by Ólafur Búi Ólafsson
// Native ES module — served and run by the browser as-is (no bundler).
// Client-first: ping the server's health endpoint and add a touch of interactivity.
const statusEl = document.getElementById("health");
async function checkHealth() {
try {
const res = await fetch("/api/health", { headers: { accept: "application/json" } });
if (!res.ok) throw new Error(`status ${res.status}`);
const data = await res.json();
statusEl.textContent = `server up · ${data.framework} v${data.version}`;
statusEl.classList.add("ok");
} catch (err) {
statusEl.textContent = `server unreachable: ${err.message}`;
}
}
// Demo form: show a toast instead of navigating.
const form = document.getElementById("signup");
const toast = document.getElementById("toast");
if (form && toast) {
form.addEventListener("submit", (e) => {
e.preventDefault();
toast.hidden = false;
setTimeout(() => (toast.hidden = true), 2500);
});
}
checkHealth();