log posts
This commit is contained in:
parent
aebe28a5f1
commit
ba5e0673ce
3
main.ts
3
main.ts
@ -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),
|
||||
}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user