Files
gerbeur/api/lib/static.ts
2026-03-15 17:15:46 +00:00

17 lines
393 B
TypeScript

import { Context, Next } from "@oak/oak";
export default function routeStaticFilesFrom(staticPaths: string[]) {
return async (context: Context<Record<string, object>>, next: Next) => {
for (const path of staticPaths) {
try {
await context.send({ root: path, index: "index.html" });
return;
} catch {
continue;
}
}
await next();
};
}