master
Bel LaPointe 2018-10-13 19:24:08 -06:00
parent a26f3aa21f
commit a82e9380df
1 changed files with 9 additions and 1 deletions

10
main.go
View File

@ -12,11 +12,19 @@ import (
"flag"
"log"
"net/http"
"os"
"path"
"path/filepath"
)
func main() {
exePath, err := filepath.Abs(filepath.Dir(os.Args[0]))
if err != nil {
panic(err)
}
port := flag.String("p", "8100", "port to serve on")
directory := flag.String("d", ".", "the directory of static file to host")
directory := flag.String("d", path.Join(exePath, "public"), "the directory of static file to host")
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*directory)))