server/static.ts

Static file serving middleware for SvelteKit static builds.

Multi-step static serving:

  • Step 1: Exact path match (handles /, assets, images)
  • Step 2: .html fallback for clean URLs (/about → /about.html)
  • Step 3 (optional): SPA fallback for client-side routes
view source

Declarations
#

3 declarations

create_static_middleware
#

server/static.ts view source

(serve_static: ServeStaticFactory, options?: { root?: string | undefined; spa_fallback?: string | undefined; is_spa_route?: ((path: string) => boolean) | undefined; } | undefined): MiddlewareHandler[] import {create_static_middleware} from '@fuzdev/fuz_app/server/static.js';

Create static file serving middleware for SvelteKit static builds.

Returns an array of middleware handlers to register on '/*'.

serve_static

runtime-specific serveStatic factory

options?

optional root directory and SPA fallback path

type { root?: string | undefined; spa_fallback?: string | undefined; is_spa_route?: ((path: string) => boolean) | undefined; }
optional

returns

MiddlewareHandler[]

ServeStaticFactory
#

server/static.ts view source

ServeStaticFactory import type {ServeStaticFactory} from '@fuzdev/fuz_app/server/static.js';

Factory function that creates a static file serving middleware.

Matches the signature of serveStatic from @hono/node-server/serve-static and @hono/bun.

(call)

type (options: ServeStaticOptions): MiddlewareHandler

options

returns MiddlewareHandler

ServeStaticOptions
#

server/static.ts view source

ServeStaticOptions import type {ServeStaticOptions} from '@fuzdev/fuz_app/server/static.js';

Options for serve_static factory functions (matches Hono's serveStatic signature).

root

type string

rewriteRequestPath?

type (path: string): string

path

type string
returns string

mimes?

type Record<string, string>

Imported by
#