panorama/apps/codetrack/index.ts

19 lines
451 B
TypeScript
Raw Normal View History

2024-07-10 05:12:17 +00:00
import type { Context } from "koa";
export async function createHeartbeats(ctx: Context) {
const results = [];
for (const heartbeat of ctx.request.body) {
console.log("heartbeat", heartbeat);
const resp = await fetch("http://localhost:3000/node", {
method: "PUT",
});
const data = await resp.json();
results.push({
id: data.id,
});
}
ctx.status = 400;
console.log("results", results);
ctx.body = {};
}