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
/** @jsxImportSource npm:hono@3/jsx */
import { lastlogin } from "https://esm.town/v/stevekrouse/lastlogin?v=5";
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/", (c) => {
const email = c.req.header("X-LastLogin-Email");
if (email) {
return c.html(
<div>
<h1>Welcome, {email}!</h1>
<a href="/auth/logout">Logout</a>
</div>
);
} else {
return c.html(
<div>
<h1>Welcome to the App</h1>
<p>Please sign in to continue.</p>
<a href="/auth/login">Sign In</a>
</div>
);
}
});
export default lastlogin(app.fetch);