server/static.ts

Static file serving middleware for SvelteKit static builds.

Provides multi-phase static serving: - Phase 1: Exact path match (handles /, assets, images) - Phase 2: .html fallback for clean URLs (/about/about.html) - Phase 3 (optional): SPA fallback for client-side routes

Declarations
#

3 declarations

view source

create_static_middleware
#

server/static.ts view source

(serve_static: ServeStaticFactory, options?: { root?: string | undefined; spa_fallback?: string | undefined; } | undefined): MiddlewareHandler[]

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; } | undefined
optional

returns

MiddlewareHandler[]

array of middleware handlers to apply in order

ServeStaticFactory
#

server/static.ts view source

ServeStaticFactory

Factory function that creates a static file serving middleware.

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

ServeStaticOptions
#

server/static.ts view source

ServeStaticOptions

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

root

type string

rewriteRequestPath

type (path: string) => string

mimes

type Record<string, string>

Imported by
#