Files

10 lines
315 B
TypeScript

// GET /api/time — returns the current server time.
export async function API_get(req: Request): Promise<Response> {
const now = new Date();
return Response.json({
time: now.toISOString(),
unix: Math.floor(now.getTime() / 1000),
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
});
}