Back
Version 24
11/1/2023
import { saveToTana } from "https://esm.town/v/lavacxx/saveToTana";
import { APIPlainNode } from "https://esm.town/v/lavacxx/tanaTypes";
import { Hono } from "npm:hono";
const token = Deno.env.get("tanaInputAPI");
export const honoTanaEndpoint = async (req: Request) => {
const app = new Hono();
app.post("/", async c => {
let { text = "" } = await c.req.query();
let node = await c.req.json();
let payload: APIPlainNode;
if (text) {
payload.name = text;
} else if (node) {
payload = node;
}
let targetNodeId = "INBOX";
const newNode = await saveToTana(token, payload, targetNodeId);
return c.json({ newNode });
});
return app.fetch(req);
};
lavacxx-honotanaendpoint.web.val.run
Updated: November 1, 2023