github.com/mattevans/edward@v1.9.2/examples/store/auth/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 "net/http" 8 "os" 9 ) 10 11 func handler(w http.ResponseWriter, r *http.Request) { 12 fmt.Fprintf(w, "Hello: %s!", r.URL.Path[1:]) 13 } 14 15 func main() { 16 http.HandleFunc("/", handler) 17 fmt.Println("Starting to listen on port", os.Args[1]) 18 http.ListenAndServe(":"+os.Args[1], nil) 19 }