github.com/mattevans/edward@v1.9.2/examples/store/tracking/main.go (about) 1 // A simple executable that stays runnning until an interrupt is received 2 // Based on: https://gobyexample.com/signals 3 package main 4 5 import ( 6 "fmt" 7 "log" 8 "net/http" 9 "os" 10 ) 11 12 func handler(w http.ResponseWriter, r *http.Request) { 13 fmt.Fprintf(w, "Hello: %s!", r.URL.Path[1:]) 14 } 15 16 func main() { 17 http.HandleFunc("/", handler) 18 fmt.Println("Starting to listen on port", os.Args[1]) 19 20 log.Fatal(http.ListenAndServe(":"+os.Args[1], nil)) 21 }