twifeur/main.ts
2024-05-24 02:04:48 +02:00

20 lines
602 B
TypeScript
Executable file

#!/bin/env -S deno run --allow-net --unstable-kv --watch --allow-read=./pages
import { Hono } from "https://deno.land/x/hono@v4.3.10/mod.ts";
import { basicAuth, serveStatic } from "https://deno.land/x/hono@v4.3.10/middleware.ts";
const app = new Hono();
app.use("/static/*", serveStatic({ root: "./pages/" }));
app.use("/user", basicAuth({ username: "feur", password: "feur" })); // todo : transition to verify_user
app.get("/", (c) => {
return c.html("Hello Hono!");
});
import HomePage from "./pages/home.tsx";
app.get("/home", (c) => {
return c.html(HomePage());
});
Deno.serve(app.fetch);