shad-go/lectures/00-intro/web/web.go
Fedor Korotkiy c989b9f92e Fix lecture
2020-02-13 14:54:17 +03:00

17 lines
348 B
Go

package main
import (
"fmt"
"log"
"net/http"
)
func main() {
http.HandleFunc("/", handler) // each request calls handler
log.Fatal(http.ListenAndServe("localhost:8000", nil))
}
// handler echoes the Path component of the request URL r.
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "URL.Path = %q\n", r.URL.Path)
}