serv
A small dev server for static sites, single-page apps and markdown.
Yet another dev HTTP server. Not because anything was missing — I wanted one, and I could write it.
It’s a single binary on hyper and tokio. Run serv in a folder and it’s on http://127.0.0.1:8010. No config, no required project layout.
It never caches. Every request opens the file and reads it off disk again, so you always get what’s there right now. The browser still gets an ETag, and a 304 while nothing has changed, so reloads stay fast.
/about serves about.html, and /about.html redirects back, so a page has one address. -s turns on the SPA fallback, but only for navigations — a missing .js still returns 404. Range requests work, so seeking in a video works. Text gets gzipped; big files stream.
With -m it reads markdown as well, on those same rules: /about finds about.md when there is no about.html, /about.md redirects to the clean URL, and a folder with no index.html opens as its index.md or README.md rather than as a file listing — so pointing serv at a project shows you its documentation. GitHub’s extensions are on, links between documents are rewritten to the addresses serv actually serves, and a ```mermaid fence is drawn as a diagram. Syntax highlighting sits behind --features highlight: syntect is worth about a megabyte and a half, which is a lot to carry by default and fine to ask for.
The 404 page and the folder index are damask components compiled into the binary with their styles inlined, so they work offline. So does a rendered markdown page — with one exception: a page that draws a mermaid diagram loads mermaid from a CDN, because mermaid is a browser library with no Rust equivalent.
Rust, MIT. A prebuilt binary for macOS or Linux:
brew install jwo1f/tap/serv
Or from source:
cargo install --git https://github.com/JWo1F/serv