Last active
June 2, 2016 10:39
-
-
Save messyidea/f89a813ed771a461a7ab8ae42d0dfa6c to your computer and use it in GitHub Desktop.
This file contains 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 ( | |
"fmt" | |
"net/http" | |
"flag" | |
) | |
var ( | |
argPort string | |
) | |
func main() { | |
flag.StringVar(&argPort, "port", "", "Port, default is 8080.") | |
flag.Parse() | |
if argPort == "" { | |
argPort = "8080" | |
} | |
fs := http.FileServer(http.Dir(".")) | |
http.Handle("/", fs) | |
bind :=fmt.Sprintf("%s:%s", "0.0.0.0", argPort) | |
fmt.Printf("listening on %s...", bind) | |
http.ListenAndServe(bind, nil) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment