import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { blob } from "https://esm.town/v/std/blob?v=12";
import { Hono } from "npm:hono";
const app = new Hono();
const blobKey = `tinybase_example.json`;
app.get("/", (c) => {
return c.html(
<html>
<head>
<title>Tinybase Example</title>
<link rel="stylesheet" href="https://unpkg.com/missing.css@1.1.1" />
<script type="module" src="https://esm.town/v/pomdtr/tinybase_example_client" />
</head>
<body></body>
</html>,
);
});
app.get("/load", async (c) => {
const store = await blob.getJSON(blobKey);
return c.json(store);
});
app.post("/save", async (c) => {
await blob.setJSON(blobKey, await c.req.json());
return c.text("OK");
});
export default app.fetch;