Skip to main content

Crate impulse_static_server

Crate impulse_static_server 

Source
Expand description

Static server for your frontend.

This crate is a thin re-export of the static_server module in impulse-server-kit. Use the binary iks to run a stand-alone static server, or pull these items in as a library:

ⓘ
use impulse_static_server::{frontend_router, StaticRouter};

Structs§

CacheMap
In-memory cache for static files, keyed by canonicalised path.
CachedFile
Single cached file entry.
NoRedirectStaticRouter
Wildcard handler that returns 404 (via fall-through) for missing files instead of redirecting to index.html.
ProvidedRoutesStaticRouter
Wildcard handler that only serves files whose names are in possible_routes.
StaticRouter
Wildcard static-file handler that falls back to index.html.

Functions§

assets_only_router_from
Wildcard asset router that serves files from dist without falling back to index.html. Intended for SSR setups where unhandled paths must reach the SSR handler rather than yield the SPA shell.
cache_runner
Background task that invalidates cache entries on filesystem changes.
frontend_router
Router that serves files from ./dist (development) or /usr/local/frontend-dist (container).
frontend_router_from_given_dist
Router serving files from dist, with index.html fallback for unknown paths.
send_file
Send a file from cache or disk, falling back to streaming for large files.
send_html
Send an HTML page from cache or disk.