Sometimes you want a dirt-simple way of serving one or more files via HTTP. You may be in the middle of developing some software and just want to easily test downloading a file, or often it's the easiest way to copy a file from your local machine, etc.
Below are multiple ways of doing so, separated by language.
I encourage you to open a pull request or issue to add to this list!
- go exec 'http.ListenAndServe(
:8080
, http.FileServer(http.Dir(.
)))'
-
python -m SimpleHTTPServer <port#>
supports GET, HEAD
default port 8000
-
easy, one-time file servring (i.e. quits after file is downloaded)
when run will display URL where file is served
-
python3 -m http.server <port#>
default port 8000
-
ruby -run -e httpd . <-p port#>
default port 880
-
cargo install microserver
From the command line: microserver <path/to/folder>
Will serve single single page applications