A better static file server for local development.
Alternatively: I got tired of using python3 -m http.server
.
- Support for
404.html
- On-the-fly directory listing whenever no
index.html
present - No more
OSError: Address already in use
: it will retry with every port up to 65535
dev
is available in Homebrew:
brew install hugginsio/tap/dev
Alternatively, you can download binaries for your platform from the latest release.
Usage: dev [options]
A simple static file server for local development.
Options:
-dir string
Directory to serve files from (default ".")
-port int
Port to bind server to (default 8000)
If you are not looking for a dedicated command line tool, the custom HttpHandler
and port
acquisition logic can be imported for use in your own Go programs:
go get github.com/hugginsio/dev
In your Go program, you can import github.com/hugginsio/dev/handler
or github.com/hugginsio/dev/port
.
Documentation is available on Go Packages.