github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/doc/articles/wiki/http-sample.go (about) 1 package main 2 3 import ( 4 "fmt" 5 "net/http" 6 ) 7 8 func handler(w http.ResponseWriter, r *http.Request) { 9 fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) 10 } 11 12 func main() { 13 http.HandleFunc("/", handler) 14 http.ListenAndServe(":8080", nil) 15 }