Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What web server do you use with Go for web service?

Tags:

go

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?

like image 794
loyalflow Avatar asked Jul 25 '12 18:07

loyalflow


1 Answers

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.

like image 153
Zippo Avatar answered Oct 08 '22 19:10

Zippo