route/cmd/helloserver/main.go

22 lines
337 B
Go

package main
import (
"flag"
"fmt"
"net/http"
)
var (
port = flag.String("port", "9090", "HTTP port to listen on")
)
func main() {
flag.Parse()
http.ListenAndServe(":"+*port, http.HandlerFunc(handle))
}
func handle(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Route is go!")
fmt.Fprintf(w, "%#v\n", r.Header)
}