zry 4 years ago
parent
commit
bac37f4292
4 changed files with 20 additions and 1 deletions
  1. 0 1
      .gitignore
  2. BIN
      SimpleHttpTestServer_Win32.exe
  3. BIN
      SimpleHttpTestServer_linux_linux
  4. 20 0
      main.go

+ 0 - 1
.gitignore

@@ -20,7 +20,6 @@ _cgo_export.*
 
 _testmain.go
 
-*.exe
 *.test
 *.prof
 

BIN
SimpleHttpTestServer_Win32.exe


BIN
SimpleHttpTestServer_linux_linux


+ 20 - 0
main.go

@@ -0,0 +1,20 @@
+package main
+
+import (
+	"flag"
+	"fmt"
+	"net/http"
+)
+
+var BindPort uint
+var PathToServe string
+
+func main() {
+	flag.UintVar(&BindPort, "b", 8000, "Port to bind")
+	flag.StringVar(&PathToServe, "f", "./", "Path to serve")
+	http.Handle("/", http.FileServer(http.Dir(PathToServe)))
+	err := http.ListenAndServe(fmt.Sprintf(":%d", BindPort), nil)
+	if err != nil {
+		fmt.Println("Failed start server: ", err.Error())
+	}
+}