Last active
September 4, 2020 11:20
-
-
Save NaniteFactory/447731150e1e7f313a4ae9087e5f4121 to your computer and use it in GitHub Desktop.
fileserver written in go
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 ( | |
"flag" | |
"log" | |
"net/http" | |
) | |
var ( | |
listen = flag.String("listen", ":8080", "listen address") | |
dir = flag.String("dir", ".", "directory to serve") | |
) | |
func main() { | |
flag.Parse() | |
log.Printf("listening on %q...", *listen) | |
log.Fatal(http.ListenAndServe(*listen, http.FileServer(http.Dir(*dir)))) | |
} | |
// $ fileserver -dir=. -listen=localhost:8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment