英文:
What web server do you use with Go for web service?
问题
如果我想使用Go创建一个Web服务,我会使用哪个Web服务器?
我的Web服务需要与Mysql、redis和memcached进行交互。是否有稳定的库可用于每个服务?
英文:
If I wanted to create a web service using Go, what web server would I be using?
My web service needs to interact with Mysql, redis and memcached. Are there stable libraries for each?
答案1
得分: 18
The net/http package in the standard library is stable and concurrent (goroutine per client).
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))
After reading Writing Web Applications you will have the necessary skills to write idiomatic web applications in Go.
英文:
The net/http package in the standard library is stable and concurrent (goroutine per client).
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))
After reading Writing Web Applications you will have the necessary skills to write idiomatic web applications in Go.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论