http.Handler Interface

A Handler responds to an HTTP request. ServeHTTP should write reply headers and data to the ResponseWriter and then return. Returning signals that the request is finished; it is not valid to use the ResponseWriter or read from the Request.Body after or concurrently with the completion of the ServeHTTP call. Depending on the HTTP client… Continue reading http.Handler Interface

http.ListenAndServer

ListenAndServe starts an HTTP server. with a given address and handler. The handler is usually nil, which means to use DefaultServeMux. Handle and HandleFunc add handlers to DefaultServeMux: log.Fatal(http.ListenAndServe(“:8080”, nil)) func ListenAndServe func ListenAndServe(addr string, handler Handler) error ListenAndServe listens on the TCP network address addr and then calls Serve with handler to handle requests on… Continue reading http.ListenAndServer

Published
Categorized as net/http