import { Hono } from "https://esm.sh/hono";
import { html } from "https://esm.sh/hono/html";
const app = new Hono();
app.get("/", (c) => {
const name = "World";
return c.html(
html`
<!DOCTYPE html>
<html>
<head>
<title>Hello from Hono</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
.container {
text-align: center;
padding: 20px;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
color: #333;
}
p {
color: #666;
}
.source-link {
margin-top: 20px;
font-size: 0.8em;
}
</style>
</head>
<body>
<div class="container">
<h1>Hello, ${name}!</h1>
<p>This page is rendered using Hono.</p>
<p class="source-link">
<a href="${import.meta.url.replace("esm.town", "val.town")}" target="_blank">View Source</a>
</p>
</div>
</body>
</html>
`,
);
});
export default async function server(req: Request): Promise<Response> {
return app.fetch(req);
}