22 lines
759 B
TypeScript
Executable file
22 lines
759 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) => c.redirect("/home"));
|
|
|
|
import HomePage from "./pages/home.tsx";
|
|
app.get("/home", (c) => c.html(HomePage()));
|
|
|
|
import LoginPage from "./pages/login.tsx";
|
|
app.get("/login", (c) => c.html(LoginPage()));
|
|
|
|
import { login_route } from "./api/login.ts";
|
|
app.post("/api/login", (c) => login_route(c));
|
|
|
|
Deno.serve(app.fetch);
|