HTTP server with built-in automatic refresh feature on file changes for developers.
- Serves static files from the current directory or specified files
- Automatic browser refresh on file changes (live reload)
- Watches files/directories for changes using fsnotify
- Injects a live reload script into served HTML files
- Customizable port via the
PORT
environment variable (default: 3000) - Simple logging with version info
When you run servus
, it starts an HTTP server and watches the current directory (or specified files/directories) for changes. When a file changes, connected browsers are notified via a Server-Sent Events (SSE) endpoint (/.servus
). A small script is injected into served HTML files, which listens for these events and reloads the page automatically.
servus # watches current directory (non-recursive)
servus `git ls-files` # watches all files in git repository
PORT=4269 servus # set custom port number
GET /
— Redirects to/index.html
GET /{file}
— Serves the requested file from the current directoryGET /.servus
— Server-Sent Events endpoint for live reload notifications
go install github.com/balazs4/servus
Or download a pre-built binary.
Start the server:
servus
Open your browser to http://localhost:3000. When you edit and save an HTML file, the page will automatically reload.
See license
balazs4
Note: This readme.md was generated by AI (opencode v0.3.5, model: github-copilot/gpt-4.1), but all code is 100% manually written.