Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Hono

Here's an example using the Hono server library with the Web API. It works great!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
const { Hono } = await import("npm:hono@3");
const app = new Hono();
app.get("/", (c) => c.text("Hono?"));
app.get("/hi", (c) => c.text("Hi!"));
app.get("/hi/:name", (c) => {
const name = c.req.param("name");
return c.text(`Hi ${capitalize(name)}`);
});
function capitalize(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
export default app.fetch;
bis-honoexample.web.val.run
March 3, 2024