T2/Phase 2A: port auth + infrastructure routes to Hono (~8 routes)
- /api/health: DB ping + version + uptime - /api/auth/*: NextAuth -> Auth.js standalone (credentials + passkey) - /api/domains: full CRUD - /api/realtime: SSE with PostgreSQL LISTEN/NOTIFY - /mcp: JSON-RPC 2.0 (initialize, tools/list, tools/call, resources/*) Parent: t_e1cbd87d -> t_d8654a91 (T1)
This commit is contained in:
+10
-4
@@ -1,25 +1,31 @@
|
||||
import { Hono } from "hono";
|
||||
import { cors } from "hono/cors";
|
||||
import { logger } from "hono/logger";
|
||||
import { authMiddleware } from "./middleware/auth";
|
||||
import { authRoutes } from "./routes/auth";
|
||||
import { mcpRoutes } from "./routes/mcp";
|
||||
import { realtimeRoutes } from "./routes/realtime";
|
||||
import { domainRoutes } from "./routes/domains";
|
||||
import { healthHandler } from "./routes/health";
|
||||
|
||||
const app = new Hono();
|
||||
|
||||
// Middleware
|
||||
app.use("*", cors({ origin: "http://localhost:3000", credentials: true }));
|
||||
app.use("*", logger());
|
||||
app.use("*", authMiddleware);
|
||||
|
||||
// Health check
|
||||
app.get("/api/health", (c) => {
|
||||
return c.json({ status: "ok", version: "0.1.0", runtime: "bun" });
|
||||
// Health check — expanded with DB ping
|
||||
app.get("/api/health", async (c) => {
|
||||
const result = await healthHandler();
|
||||
return c.json(result);
|
||||
});
|
||||
|
||||
// Routes
|
||||
app.route("/api/auth", authRoutes);
|
||||
app.route("/mcp", mcpRoutes);
|
||||
app.route("/api/domains", domainRoutes);
|
||||
app.route("/api", realtimeRoutes);
|
||||
app.route("/mcp", mcpRoutes);
|
||||
|
||||
const port = parseInt(process.env.PORT || "3001", 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user