log posts

This commit is contained in:
sfja 2025-07-02 00:30:48 +02:00
parent aebe28a5f1
commit ba5e0673ce

View File

@ -6,6 +6,7 @@ const router = new oak.Router();
router.post("/api/log", async (ctx) => {
const data = await ctx.request.body.json();
console.log(`POST /api/log ${JSON.stringify(data)}`);
const enc = new TextEncoder();
@ -27,7 +28,7 @@ router.get("/api/log", async (ctx) => {
.split("\n")
.filter((l) => l)
.map((entry) => entry.split("\t"))
.map(([timestamp, data]) => (console.log(timestamp, data), {
.map(([timestamp, data]) => ({
timestamp: new Date(timestamp),
data: JSON.parse(data),
}));