panorama/apps/codetrack/index.ts
2024-07-10 00:12:17 -05:00

18 lines
451 B
TypeScript

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 = {};
}