soething
This commit is contained in:
10
main.go
10
main.go
@@ -12,11 +12,19 @@ import (
|
|||||||
"flag"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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")
|
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()
|
flag.Parse()
|
||||||
|
|
||||||
http.Handle("/", http.FileServer(http.Dir(*directory)))
|
http.Handle("/", http.FileServer(http.Dir(*directory)))
|
||||||
|
|||||||
Reference in New Issue
Block a user