fix: Express 5 named wildcard in corpus-gather stub

This commit is contained in:
gitadmin 2026-05-02 13:18:50 +00:00
parent 4cccaeb488
commit ee0483f2a7

View file

@ -13,7 +13,7 @@ import type { Express } from "express";
const WORKER_URL = process.env.CORPUS_GATHER_WORKER_URL || null; const WORKER_URL = process.env.CORPUS_GATHER_WORKER_URL || null;
export function registerCorpusGatherRoutes(app: Express) { export function registerCorpusGatherRoutes(app: Express) {
app.all("/api/corpus/gather*", async (req: any, res: any) => { async function gatherHandler(req: any, res: any) {
if (WORKER_URL) { if (WORKER_URL) {
try { try {
const upstream = await fetch(`${WORKER_URL}${req.path}`, { const upstream = await fetch(`${WORKER_URL}${req.path}`, {
@ -29,7 +29,9 @@ export function registerCorpusGatherRoutes(app: Express) {
} }
res.status(503).json({ res.status(503).json({
error: "corpus-gather-worker not configured", error: "corpus-gather-worker not configured",
hint: "Set CORPUS_GATHER_WORKER_URL to the Hetzner worker URL, or run corpus-gather-worker.ts locally.", hint: "Set CORPUS_GATHER_WORKER_URL to the Hetzner worker URL.",
});
}); });
} }
app.all("/api/corpus/gather", gatherHandler);
app.all("/api/corpus/gather/*path", gatherHandler);
}