summaryrefslogtreecommitdiff
path: root/doc/codelab/wiki/http-sample.go
blob: 11d5d78613590e4c8098d70f85bba58262026003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
package main

import (
	"fmt"
	"http"
)

func handler(c *http.Conn, r *http.Request) {
	fmt.Fprintf(c, "Hi there, I love %s!", r.URL.Path[1:])
}

func main() {
	http.HandleFunc("/", handler)
	http.ListenAndServe(":8080", nil)
}