| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "flag" | 4 "flag" |
| 5 "net/http" | 5 "net/http" |
| 6 ) | |
| 7 | 6 |
| 8 import ( | |
| 9 "github.com/golang/glog" | 7 "github.com/golang/glog" |
| 10 ) | 8 ) |
| 11 | 9 |
| 12 // flags | 10 // Command line flags. |
| 13 var ( | 11 var ( |
| 14 port = flag.String("port", ":9000", "HTTP service address (e.g., ':
9000')") | 12 port = flag.String("port", ":9000", "HTTP service address (e.g., ':
9000')") |
| 15 staticDir = flag.String("static", "./app", "Directory with static conten
t to serve") | 13 staticDir = flag.String("static", "./app", "Directory with static conten
t to serve") |
| 16 | 14 |
| 17 // TODO (stephana): Just ideas to be sorted out later | 15 // TODO (stephana): Just ideas to be sorted out later |
| 18 // tempDir = flag.String("temp", "./.cache", | 16 // tempDir = flag.String("temp", "./.cache", |
| 19 // "Directory to store temporary file and application cache") | 17 // "Directory to store temporary file and application cache") |
| 20 ) | 18 ) |
| 21 | 19 |
| 22 func main() { | 20 func main() { |
| 23 // parse the arguments | |
| 24 flag.Parse() | 21 flag.Parse() |
| 22 defer glog.Flush() |
| 25 | 23 |
| 26 // // Static file handling | |
| 27 http.Handle("/", http.FileServer(http.Dir(*staticDir))) | 24 http.Handle("/", http.FileServer(http.Dir(*staticDir))) |
| 28 | 25 |
| 29 // Wire up the resources | |
| 30 | |
| 31 // Start the server | |
| 32 glog.Infoln("Serving on http://127.0.0.1" + *port) | 26 glog.Infoln("Serving on http://127.0.0.1" + *port) |
| 33 glog.Fatal(http.ListenAndServe(*port, nil)) | 27 glog.Fatal(http.ListenAndServe(*port, nil)) |
| 34 } | 28 } |
| OLD | NEW |