34 lines
959 B
TypeScript
34 lines
959 B
TypeScript
import { Hono } from "jsr:@hono/hono@4";
|
|
import { serveStatic } from "jsr:@hono/hono@4/deno";
|
|
import { initDb } from "./core/db.ts";
|
|
import { pingValkey } from "./core/valkey.ts";
|
|
import { contentNegotiation } from "./core/content_negotiation.ts";
|
|
|
|
import { authRoutes } from "./features/auth/routes.tsx";
|
|
import { adminRoutes } from "./features/admin/routes.tsx";
|
|
|
|
const app: Hono = new Hono();
|
|
|
|
app.use("*", contentNegotiation());
|
|
|
|
// Serve static assets (specifically Datastar)
|
|
app.use("/public/*", serveStatic({ root: "./" }));
|
|
|
|
// Wire Phase 2 Vertical Slices
|
|
app.route("/", authRoutes);
|
|
app.route("/admin", adminRoutes);
|
|
|
|
// Basic health check for foundation
|
|
app.get("/healthz", (c) => c.text("OK"));
|
|
|
|
if (import.meta.main) {
|
|
console.log("[Auth-Yes Next] Bootstrapping core foundation...");
|
|
await initDb();
|
|
await pingValkey();
|
|
|
|
const port = parseInt(Deno.env.get("PORT") || "8000", 10);
|
|
Deno.serve({ port }, app.fetch);
|
|
}
|
|
|
|
export default app;
|