xref: /unit/pkg/deb/debian/unit.example-go-app (revision 1329:d4d7d2ca74b1)
1373Sdefan@nginx.compackage main
2373Sdefan@nginx.com
3373Sdefan@nginx.comimport (
4373Sdefan@nginx.com    "fmt"
5373Sdefan@nginx.com    "net/http"
6*1329Smax.romanov@nginx.com    "unit.nginx.org/go"
7373Sdefan@nginx.com)
8373Sdefan@nginx.com
9373Sdefan@nginx.comfunc handler(w http.ResponseWriter, r *http.Request) {
10373Sdefan@nginx.com    w.Header().Add("Content-Type", "text/plain");
11373Sdefan@nginx.com
12373Sdefan@nginx.com    fmt.Fprintf(w, "Method : %s\n", r.Method)
13373Sdefan@nginx.com    fmt.Fprintf(w, "URL    : %s\n", r.URL.Path)
14373Sdefan@nginx.com    fmt.Fprintf(w, "Host   : %s\n", r.Host)
15373Sdefan@nginx.com}
16373Sdefan@nginx.com
17373Sdefan@nginx.comfunc main() {
18373Sdefan@nginx.com    http.HandleFunc("/", handler)
19373Sdefan@nginx.com    unit.ListenAndServe("8000", nil)
20373Sdefan@nginx.com}
21