serve¶
Instant static file server.
Synopsis¶
Description¶
Start an HTTP server to serve static files from a directory. Useful for development and quick file sharing.
Flags¶
| Flag | Short | Description | Default |
|---|---|---|---|
--port |
-p |
Port to listen on | 8080 |
--host |
Host interface to bind to | localhost |
|
--spa-mode |
Enable SPA mode (redirect 404 to index.html) | false |
|
--no-cache |
Disable browser caching | false |
|
--read-timeout-millis |
Max duration for reading request (ms) | 5000 |
|
--write-timeout-millis |
Max duration for writing response (ms) | 10000 |
|
--idle-timeout-millis |
Max idle time for keep-alive (ms) | 120000 |
|
--max-header-bytes |
Max bytes for request headers | 1048576 |
Examples¶
Serve current directory on port 8080:
Serve specific directory:
Serve on different port:
Serve on all interfaces:
Enable SPA mode (for React/Vue/Angular apps):
Disable caching for development: