Skip to content

πŸš€ A tiny command line app with no external dependencies for serving any directory as a static server

License

Notifications You must be signed in to change notification settings

tinacious/static-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

static-server

static-server is a simple command line app written in Go that serves your current working directory as a static server.

Features

  • No external dependencies are used. The project leverages native Go packages only.
  • No external runtime dependencies. Some CLI tools require you to have a specific version of Node.js, Python or another language, this does not.
  • Multi-platform: Thanks to Go, this works on macOS, Windows and Linux

Installation

Install using Go

If you have Go lang tooling installed, this is the way that is recommended since it will build the binary for your architecture and make it executable.

Install the CLI tool using go install:

go install github.com/tinacious/static-server@latest

Install manually

Go to the releases page and download the appropriate release for your operating system and architecture.

Put the file somewhere on your executables path, e.g. I use ~/.local/bin.

On macOS, you will need to trust the executable after the first run attempt in your System Preferences β†’ Privacy & Security settings.

Usage

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.

Custom 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

Uninstall

To uninstall it, simply delete the executable static-server.

If you installed it with Go, you can navigate to either $GOPATH/bin (if your $GOPATH is defined) or ~/go/bin and delete it from there.

If you installed it manually, e.g. in ~/.local/bin, delete it from there.

About

πŸš€ A tiny command line app with no external dependencies for serving any directory as a static server

Topics

Resources

License

Stars

Watchers

Forks

Languages