route/cmd/helloserver/main.go

24 lines
376 B
Go
Raw Normal View History

2017-01-20 00:31:22 +00:00
package main
import (
"flag"
"fmt"
"net/http"
"github.com/kr/pretty"
2017-01-20 00:31:22 +00:00
)
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, "%s\n", pretty.Sprint(r.Header))
2017-01-20 00:31:22 +00:00
}