Created
January 16, 2015 12:11
-
-
Save anastasop/f3534a3c4826286d0d58 to your computer and use it in GitHub Desktop.
A web server for a single directory with content sniffing
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
import ( | |
"flag" | |
"log" | |
"net/http" | |
) | |
var addr = flag.String("-h", ":8080", "host:port") | |
var dir = flag.String("-d", ".", "directory to serve") | |
func main() { | |
flag.Parse() | |
http.Handle("/", http.FileServer(http.Dir(*dir))) | |
log.Fatal(http.ListenAndServe(*addr, nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment