packagemain
import"net/http"
funcSayHello(whttp.ResponseWriter,r*http.Request){
w.Write([]byte("hello"))
}
funcmain(){
http.HandleFunc("/hello",SayHello())
http.ListenAndServe(":1234",nil)
}
listenAndServer进行端口的监听
handlefunc进行注册路径的处理函数
处理函数为sayhello
转载于:https://blog.51cto.com/gdutccd/1742494