static-server
is a simple command line app written in Go that serves your current working directory as a static server.
Install the CLI tool:
go install github.com/tinacious/static-server@latest
Run the static-server
command in any directory you'd like to serve as a web server.
If you have the following directory test
:
test
βββ index.html
βββ style.css
You can do:
cd test
static-server
This should serve the contents on a random port.
You can configure the port by passing it as an environment variable. For example, to run on port 1337 run:
PORT=1337 static-server
Open ~/go/bin
and delete static-server
.