route/vendor/github.com/Xe/x/tools/quickserv/main.go

20 lines
335 B
Go
Raw Normal View History

2017-10-06 15:29:20 +00:00
package main
import (
"flag"
"log"
"net/http"
)
var (
port = flag.String("port", "3000", "port to use")
dir = flag.String("dir", ".", "directory to serve")
)
func main() {
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*dir)))
log.Printf("Serving %s on port %s", *dir, *port)
http.ListenAndServe(":"+*port, nil)
}