mirror of
https://github.com/ProjectSegfault/website.git
synced 2024-06-02 02:17:09 +05:30
25 lines
483 B
TypeScript
25 lines
483 B
TypeScript
import type { RequestHandler } from './$types';
|
|
import statusData from "./statusData";
|
|
|
|
const map = new Map();
|
|
|
|
const updateMap = () => {
|
|
map.set("data", {
|
|
status: statusData,
|
|
updated: Math.floor(Date.now() / 1000)
|
|
});
|
|
};
|
|
|
|
updateMap();
|
|
|
|
setInterval(updateMap, 60000);
|
|
|
|
export const GET = (() => {
|
|
const data = map.get("data");
|
|
|
|
return new Response(JSON.stringify(data), {
|
|
headers: {
|
|
"content-type": "application/json; charset=utf-8"
|
|
}
|
|
});
|
|
}) satisfies RequestHandler; |