mdoTomofumi Chiba
9/9/2023, 8:56:12 AM

VanJS(SSR) on Hono on Deno

// hello.ts
import { Hono } from "https://deno.land/x/[email protected]/mod.ts";
import van from "https://deno.land/x/[email protected]/src/van-plate.js";

const { a, body, li, p, ul } = van.tags;

const app = new Hono();

app.get("/", (c) =>
  c.html(van.html(
    body(
      p("Your user-agent is: ", c.req.headers.get("user-agent") ?? "Unknown"),
      p("👋Hello"),
      ul(
        li("🗺️World"),
        li(a({ href: "https://vanjs.org/" }, "🍦VanJS")),
      ),
    ),
  )));

Deno.serve(app.fetch);
deno run --allow-net=:8000 hello.ts
TweetLike