Files
gf/.example/net/ghttp/server/nethttp_server.go

20 lines
323 B
Go
Raw Normal View History

package main
import (
2019-04-03 00:03:46 +08:00
"net/http"
"time"
)
func main() {
2019-04-03 00:03:46 +08:00
s := &http.Server{
Addr: ":8199",
ReadTimeout: 2 * time.Second,
WriteTimeout: 2 * time.Second,
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hi"))
time.Sleep(3 * time.Second)
})
s.ListenAndServe()
}