| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
"log" |
| 6 |
"net/http" |
| 7 |
) |
| 8 |
|
| 9 |
func handler(w http.ResponseWriter, r *http.Request) { |
| 10 |
fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:]) |
| 11 |
} |
| 12 |
|
| 13 |
func main() { |
| 14 |
http.HandleFunc("/", handler) |
| 15 |
log.Fatal(http.ListenAndServe(":8080", nil)) |
| 16 |
} |
| 17 |
|
| 18 |
// From https://golang.org/doc/articles/wiki/#tmp_3 |