This commit is contained in:
JOLIMAITRE Matthieu 2024-05-24 02:04:48 +02:00
commit 2737aadc7f
13 changed files with 391 additions and 0 deletions

20
main.ts Executable file
View file

@ -0,0 +1,20 @@
#!/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);