Go-restful is a good and easy to use Go RESTful style framework, but here is something i am wondering about (this is just a piece of code):
func main() {
service := new(restful.WebService)
service.Route(
service.GET("/{user-id}").To(FindUser).
Returns(200, "hello", noMessageValue).
Returns(500, "internal error", noMessageValue))
restful.Add(service)
http.ListenAndServe(":8080", nil)
}
This code can work well. Notice the last line http.ListenAndServe(":8080", nil)
, it does not pass any handler to the ListenAndServe method (it passes a nil value instead), just the port string. Does anyone know how go-restful implements handler binding ?