v3: added opengraph support to the app, wrote README instructions incl. a Docker image
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { Context, Next } from "@oak/oak";
|
||||
import { Context, Next, send } from "@oak/oak";
|
||||
|
||||
export default function routeStaticFilesFrom(staticPaths: string[]) {
|
||||
export 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" });
|
||||
await send(context, context.request.url.pathname, {
|
||||
root: path,
|
||||
index: "index.html",
|
||||
});
|
||||
return;
|
||||
} catch {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user