4 releases
Uses new Rust 2024
| new 1.0.0-alpha.9 | Feb 3, 2026 |
|---|---|
| 1.0.0-alpha.6 | Nov 14, 2025 |
| 0.12.0-alpha.3 | Jul 21, 2025 |
#2 in #dist
35KB
504 lines
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
Build
This project is supporting Deployer. You can build server with:
deployer build
Or, alternatively, just build with cargo:
cargo build --release
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:
[dependencies]
impulse-static-server = { git = "https://github.com/impulse-sw/impulse-kit.git", tag = "0.11" }
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
Dependencies
~69–95MB
~2M SLoC