port
This commit is contained in:
parent
ecd9d69996
commit
66f13d9a83
8
main.go
8
main.go
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -29,7 +30,14 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
port := ":5050"
|
port := ":5050"
|
||||||
|
|
||||||
|
flag.Parse()
|
||||||
|
if flag.NArg() != 0 {
|
||||||
|
port = ":" + flag.Arg(0)
|
||||||
|
}
|
||||||
|
|
||||||
http.HandleFunc("/", handler)
|
http.HandleFunc("/", handler)
|
||||||
fmt.Println("spa-server starting on localhost" + port)
|
fmt.Println("spa-server starting on localhost" + port)
|
||||||
err := http.ListenAndServe(port, nil)
|
err := http.ListenAndServe(port, nil)
|
||||||
|
|
Loading…
Reference in New Issue