From 66f13d9a83187aa681aa5a183528e1d77f247052 Mon Sep 17 00:00:00 2001 From: amutake Date: Tue, 30 Dec 2014 05:41:51 +0900 Subject: [PATCH] port --- main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/main.go b/main.go index c7d8619..c12dfee 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "log" "net/http" @@ -29,7 +30,14 @@ func handler(w http.ResponseWriter, r *http.Request) { } func main() { + port := ":5050" + + flag.Parse() + if flag.NArg() != 0 { + port = ":" + flag.Arg(0) + } + http.HandleFunc("/", handler) fmt.Println("spa-server starting on localhost" + port) err := http.ListenAndServe(port, nil)