package main
import "net/http"
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
_, err := w.Write([]byte("hello, world"))
if err != nil {
return
}
})
err := http.ListenAndServe(":8080", nil)
if err != nil {
return
}
}
Go 创建基于 HTTP 协议的 Web 服务
扫码请TT00喝杯奶茶~~