美文网首页
golang 最简单的http服务代码

golang 最简单的http服务代码

作者: 千罹 | 来源:发表于2019-11-11 19:56 被阅读0次
package main
 
import (
    "fmt"
    "net/http"
)
 
func IndexHandler(resp http.ResponseWriter, req *http.Request) {
    fmt.Println("hello world")
}
 
func main() {
    http.HandleFunc("/", IndexHandler)
    http.ListenAndServe("127.0.0.0:8200", nil)
}

相关文章

网友评论

      本文标题:golang 最简单的http服务代码

      本文链接:https://www.haomeiwen.com/subject/qdtxictx.html