xref: /unit/pkg/rpm/rpmbuild/SOURCES/unit.example-go-app (revision 372:616449084bee)
1package main
2
3import (
4    "fmt"
5    "net/http"
6    "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}
21