Alpha. Vary is under active development and not ready for production use. Syntax, APIs, performance, and behaviour may change between releases.
Static HTTP Server
Serve static files with a built-in HTTP server:
import http
http.serve("./public", port=3000, spa=True)
| Function | Returns | Description |
|---|---|---|
http.serve(directory, port?, host?, spa?) | None | Start a blocking static file server |
Defaults: port=4000, host="127.0.0.1", spa=False. SPA mode serves index.html for paths that don't match a file (for client-side routing). Supports HTML, CSS, JS, JSON, SVG, images, WASM, and more.