Slide 26
Slide 26 text
const app = new Hono<{
Bindings: { TEST_KV: KVNamespace }
}>();
app.get("/counter", async (c) => {
const key = c.req.query()["key"] || "defaultKey";
const count = Number(await c.env.TEST_KV.get(key));
const count = !isNaN(value) ? value + 1 : 1;
await c.env.TEST_KV.put(key, String(count));
return c.text(String(count));
});
export default app;
JOEFYUT
ϛυϧΣΞΛ͑Δʢྫ,7ʣ