Go for Web服务使用什么Web服务器?

loy*_*low 7 go

如果我想使用Go创建Web服务,我将使用什么Web服务器?

我的Web服务需要与Mysql,redis和memcached进行交互.每个都有稳定的库吗?

Mos*_*vah 18

标准库中的net/http包是稳定且并发的(每个客户端goroutine).

http.Handle("/foo", fooHandler)

http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hello, %q", html.EscapeString(r.URL.Path))
})

log.Fatal(http.ListenAndServe(":8080", nil))
Run Code Online (Sandbox Code Playgroud)

阅读完Web应用程序后,您将拥有在Go中编写惯用Web应用程序的必要技能.