function createStaticAssetHandler
Since 0.1.0
createStaticAssetHandler(options: { fs: IFileSystem; assetsDir: string; assetUrlPrefix: string; }): RouteHandler

Creates a static-asset RouteHandler that serves files from a directory using the injected IFileSystem.

Returns 404 when fs is absent or the requested file is missing.

Parameters

options: { fs: IFileSystem; assetsDir: string; assetUrlPrefix: string; }

Configuration

Return Type

A route handler function

Usage

import { createStaticAssetHandler } from "react-router-plugin/src/index.ts";