本篇文章給大家介紹有關(guān)Golang的相關(guān)知識,聊聊Go Http Server框架的怎么快速實現(xiàn)的,希望對大家有所幫助。
在Go想使用 http server,最簡單的方法是使用 http/net
err := http.ListenAndServe(":8080", nil)if err != nil { panic(err.Error())}http.HandleFunc("/hello", func(writer http.ResponseWriter, request *http.Request) { writer.Write([]byte("Hello"))})
登錄后復(fù)制
定義 handle func【