blob: 3512c240710985254e294184331110e9676fb8d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package main
import (
"io"
"log"
"net/http"
)
type handler struct{}
func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
io.WriteString(w, "Hello world!")
}
func main() {
mux := http.NewServeMux()
mux.Handle("/{$}", &handler{})
srv := http.Server{
Addr: ":8080",
Handler: mux,
}
log.Println("Serving on port 8080...")
log.Fatal(srv.ListenAndServe())
}
|