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
27
28
29
30
31
32
/** @jsx jsx */
import { Hono } from "npm:hono@3";
import { jsx } from "npm:hono@3/jsx";
const app = new Hono();
// Server-side rendering
app.get("/", async (c) => {
const html = (
<html>
<head>
<title >Hono/JSX Example</title>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div class="py-2 px-4">
<h1 class="text-4xl font-bold mt-2 mb-4">Welcome to the Hono/JSX/Alpine 🏔️🏔️ Example!</h1>
<h2 class="text-xl font-bold mb-4" x-data="{ message: 'I ❤️ Alpine' }" x-text="message"></h2>
<div x-data="{ count: 0 }">
<button class="border-2 border-slate-500 rounded-md px-1 py-1" x-on:click="count++">Increment</button>
<span class="pl-4" x-text="count"></span>
</div>
</div>
</body>
</html>
);
return c.html(html);
});
export default app.fetch;