Replace catch-all proxy with dedicated routes, add 404 page

- Dedicated proxy routes for sessions, messages, search, memory, config
- Removes [...path] catch-all that conflicted with specific routes
- Session detail + delete proxy
- Custom 404 page matching design system
This commit is contained in:
Hermes
2026-04-09 21:20:15 -05:00
parent a5f63e8aba
commit 159b175774
8 changed files with 141 additions and 63 deletions
+18
View File
@@ -0,0 +1,18 @@
import { NextRequest, NextResponse } from "next/server";
const BACKEND = process.env.HERMES_BACKEND_URL || "http://127.0.0.1:8643";
export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const qs = req.nextUrl.search;
try {
const res = await fetch(BACKEND + "/api/sessions/" + id + "/messages" + qs);
const data = await res.text();
return new NextResponse(data, {
status: res.status,
headers: { "content-type": "application/json" },
});
} catch {
return NextResponse.json({ items: [], total: 0 }, { status: 502 });
}
}
+31
View File
@@ -0,0 +1,31 @@
import { NextRequest, NextResponse } from "next/server";
const BACKEND = process.env.HERMES_BACKEND_URL || "http://127.0.0.1:8643";
export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
try {
const res = await fetch(BACKEND + "/api/sessions/" + id);
const data = await res.text();
return new NextResponse(data, {
status: res.status,
headers: { "content-type": "application/json" },
});
} catch {
return NextResponse.json({ error: "backend unreachable" }, { status: 502 });
}
}
export async function DELETE(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
try {
const res = await fetch(BACKEND + "/api/sessions/" + id, { method: "DELETE" });
const data = await res.text();
return new NextResponse(data, {
status: res.status,
headers: { "content-type": "application/json" },
});
} catch {
return NextResponse.json({ error: "backend unreachable" }, { status: 502 });
}
}