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§
- Cache
Map - In-memory cache for static files, keyed by canonicalised path.
- Cached
File - Single cached file entry.
- NoRedirect
Static Router - Wildcard handler that returns 404 (via fall-through) for missing files
instead of redirecting to
index.html. - Provided
Routes Static Router - Wildcard handler that only serves files whose names are in
possible_routes. - Static
Router - Wildcard static-file handler that falls back to
index.html.
Functions§
- assets_
only_ router_ from - Wildcard asset router that serves files from
distwithout falling back toindex.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, withindex.htmlfallback 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.