diff options
| author | David Hurst | 2016-04-16 00:30:38 -0600 |
|---|---|---|
| committer | David Hurst | 2016-04-16 00:30:38 -0600 |
| commit | 0385b1081aab533fce98f5ec1dd9b8d476d65581 (patch) | |
| tree | 4d4fb25eeae515a8726a8cbd718afceb67cd9bcc | |
| parent | 0994d59e4531fe2bda0bbdf3614b5eb8188327c7 (diff) | |
| download | torpedo-0385b1081aab533fce98f5ec1dd9b8d476d65581.tar.gz torpedo-0385b1081aab533fce98f5ec1dd9b8d476d65581.zip | |
add port to command line options
| -rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -3,6 +3,7 @@ package main | |||
| 3 | import ( | 3 | import ( |
| 4 | "bytes" | 4 | "bytes" |
| 5 | "encoding/xml" | 5 | "encoding/xml" |
| 6 | "flag" | ||
| 6 | "fmt" | 7 | "fmt" |
| 7 | "github.com/sideshowdave7/torpedo" | 8 | "github.com/sideshowdave7/torpedo" |
| 8 | "net/url" | 9 | "net/url" |
| @@ -38,11 +39,13 @@ func (ping) Get(values url.Values) (int, string) { | |||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | func main() { | 41 | func main() { |
| 42 | var port = flag.Int("port", 8000, "Port number to listen on") | ||
| 43 | flag.Parse() | ||
| 41 | 44 | ||
| 42 | ping := new(ping) | 45 | ping := new(ping) |
| 43 | 46 | ||
| 44 | var api = new(torpedo.API) | 47 | var api = new(torpedo.API) |
| 45 | api.AddResource(ping, "/rest/ping.view") | 48 | api.AddResource(ping, "/rest/ping.view") |
| 46 | api.Start(3000) | 49 | api.Start(*port) |
| 47 | 50 | ||
| 48 | } | 51 | } |