Files
aurorabot/src/web/routes/home.ts

26 lines
814 B
TypeScript

import { BaseLayout } from "../views/layout";
import { formatUptime } from "../utils/format";
export function homeRoute(): Response {
const uptime = formatUptime(process.uptime());
const startTimestamp = Date.now() - (process.uptime() * 1000);
const content = `
<div class="card">
<h2>Welcome</h2>
<p>The Aurora web server is up and running!</p>
</div>
<div class="card">
<h3>Status</h3>
<p>System operational.</p>
<p><strong>Uptime:</strong> <span id="uptime-display" data-start-timestamp="${Math.floor(startTimestamp)}">${uptime}</span></p>
</div>
`;
const html = BaseLayout({ title: "Home", content });
return new Response(html, {
headers: { "Content-Type": "text/html" },
});
}