A quick HTTP fileserver
go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
467 B

// Command quickserv serves a folder of files over HTTP quickly.
package main
import (
"flag"
"log"
"net/http"
"github.com/facebookarchive/flagenv"
)
var (
port = flag.String("port", "3000", "port to use")
dir = flag.String("dir", ".", "directory to serve")
)
func main() {
flagenv.Parse()
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*dir)))
log.Printf("Serving %s on port %s", *dir, *port)
log.Fatal(http.ListenAndServe(":"+*port, nil))
}