xref: /unit/test/go/404/app.go (revision 1329:d4d7d2ca74b1)
1package main
2
3import (
4	"io"
5	"io/ioutil"
6	"net/http"
7	"unit.nginx.org/go"
8)
9
10func handler(w http.ResponseWriter, r *http.Request) {
11	b, e := ioutil.ReadFile("404.html")
12
13	if e == nil {
14		w.WriteHeader(http.StatusNotFound)
15		io.WriteString(w, string(b))
16	}
17}
18
19func main() {
20	http.HandleFunc("/", handler)
21	unit.ListenAndServe(":7080", nil)
22}
23