function routeStaticFilesFrom
routeStaticFilesFrom(staticPaths: string[]): (
context: Context<Record<string, object>>,
next: Next
) => Promise<void>

Returns the middleware that serves a static file from the first of staticPaths that has it, and index.html of the first for any other path. Hashed build output is cached for a year, and a missing chunk is a 404. main.ts passes dist/ then public/.

Parameters

staticPaths: string[]

Return Type

(
context: Context<Record<string, object>>,
next: Next
) => Promise<void>

Usage

import { routeStaticFilesFrom } from "api/lib/static.ts";