Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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
import { blob } from "https://esm.town/v/std/blob";
import { Hono } from "npm:hono@3";
const app = new Hono();
const count = await blob.getJSON("count") as number || 0;
app.get("/", async (c) => {
await blob.setJSON("count", count + 1);
const eyes = new Array(count).fill("👁️").join("");
return c.text(`Every visit adds an eye.\n\n${eyes}`);
});
app.get("/reset", async (c) => {
const { key } = c.req.query();
if (key !== Deno.env.get("EYE_KEY")) {
c.status(401);
return c.text("unauthorized");
}
await blob.setJSON("count", 0);
return c.text(`count changed from ${count} to 0`);
});
export default app.fetch;
agmm-sauron.web.val.run
February 29, 2024