Created
December 3, 2015 03:03
-
-
Save cubarco/0e129222b6e3946bf117 to your computer and use it in GitHub Desktop.
This is a golang alternative to the SimpleHTTPServer of Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
var port string | |
flag.StringVar(&port, "port", "8000", "the port of http file server") | |
flag.Parse() | |
fmt.Printf("Serving HTTP on 0.0.0.0 port %s ...\n", port) | |
h := http.FileServer(http.Dir(".")) | |
http.ListenAndServe(":"+port, h) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment