impulse-static-server
Simple static server. Features:
- running on top of
impulse-server-kit(see configuration example) - serves all your files from
distor/usr/local/frontend-dist/folder - when receives any request other than
/, it returnsindex.html, excluding files - provides in-memory cache for files less than 16 MiB via
CustomStaticRouter::new_with_cacheror by default - withETagandLast-Modified
[!NOTE] Since v1.1.1 the routing logic lives in
impulse-server-kit::static_server, behind thestatic-serverfeature. This crate is a thin re-export and theiksbinary entry point. The same handlers power asset serving for the Leptos SSR adapter (leptos-ssrfeature), so SSR setups get the same logging, caching andETag/Last-Modifiedbehaviour.
Build
This project is supporting Deployer. You can build server with:
Or, alternatively, just build with cargo:
Usage
- Place your files inside
distfolder. - Place
impulse-static-serverexecutable neardistfolder. - Start
./impulse-static-server.
[!NOTE] There is no need to specify working dir, static server must work with distribution files placed nearly.
Usage as a library
Just include it into your Cargo.toml:
[]
= { = "https://github.com/impulse-sw/impulse-kit.git", = "1.1.0" }
and use one of these functions:
frontend_router- same behavior as the binary Static Serverfrontend_router_from_given_dist- you can specify any dist folder you want