1
0
mirror of https://github.com/golang/go synced 2024-11-24 09:00:13 -07:00
go/doc/articles/wiki/http-sample.go
2012-02-27 11:25:43 +11:00

16 lines
241 B
Go

package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
}
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8080", nil)
}