servd documentation
Everything you need to serve static files, SPAs, and proxied APIs from one binary.
Getting started
- Introduction What servd is, when to reach for it, and how it differs from a typical static file server.
- Installation Install servd from npm, run it without installing, or build the single Go binary from source.
- Quick start Serve a directory in seconds, add an SPA and an API proxy, and confirm what is being served.
Guides
- Static & SPA Mounts, directory indexes, cache revalidation, and content negotiation for static files and single-page apps.
- Proxying HTTP & WebSocket Reverse-proxy HTTP APIs and tunnel WebSocket connections through the same origin, with prefix rewriting.
- CORS & Host filtering Allow cross-origin requests with CORS and restrict which Host headers servd accepts.
- TLS (HTTPS & WSS) Serve HTTPS and WSS from a PEM certificate and key over TLS 1.2+.
- Daemon mode Run servd detached with a supervisor that restarts a crashed worker, and control it per port.
Reference
- CLI reference Every servd flag, its arguments, and the rules that govern routing and precedence.
- npm distribution How servd ships a single launcher plus per-platform binaries, and how the launcher resolves them.
- Comparison with http-server How servd compares to npm's http-server and when to choose each.