unit.example-go-app (373:b09757e4984e) unit.example-go-app (399:669d5634939d)
1package main
2
3import (
4 "fmt"
5 "net/http"
1package main
2
3import (
4 "fmt"
5 "net/http"
6 "unit"
6 "nginx/unit"
7)
8
9func handler(w http.ResponseWriter, r *http.Request) {
10 w.Header().Add("Content-Type", "text/plain");
11
12 fmt.Fprintf(w, "Method : %s\n", r.Method)
13 fmt.Fprintf(w, "URL : %s\n", r.URL.Path)
14 fmt.Fprintf(w, "Host : %s\n", r.Host)
15}
16
17func main() {
18 http.HandleFunc("/", handler)
19 unit.ListenAndServe("8000", nil)
20}
7)
8
9func handler(w http.ResponseWriter, r *http.Request) {
10 w.Header().Add("Content-Type", "text/plain");
11
12 fmt.Fprintf(w, "Method : %s\n", r.Method)
13 fmt.Fprintf(w, "URL : %s\n", r.URL.Path)
14 fmt.Fprintf(w, "Host : %s\n", r.Host)
15}
16
17func main() {
18 http.HandleFunc("/", handler)
19 unit.ListenAndServe("8000", nil)
20}