impedivity-tanasave.web.val.run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { saveToTana } from "https://esm.town/v/impedivity/saveToTana";
import { APIPlainNode } from "https://esm.town/v/nbbaier/tanaTypes";
import { Hono } from "npm:hono";
const token = Deno.env.get("tanaInputAPI");
console.log(token);
console.log(Request);
// console.log(console.log(JSON.stringify(Request)));
export const tanaSave = async (req: Request) => {
// console.log("Hello, World!");
const app = new Hono();
app.get("/", async c => c.text("Hello from Hono!"));
app.get("/save", async c => c.text("Endpoint: /save"));
app.get("/save2", async c => {
let { text, url } = c.req.query();
console.log(c.req);
const payload: APIPlainNode = {
name: text,
children: [
{ name: "child 1" },
{ type: "field", attributeId: "cwi23sOzRSh8" },
],
};
const newNode = await saveToTana(token, payload);
return c.json({ newNode });
});
return app.fetch(req);
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
June 7, 2024