Go has a powerful HTTP package in the standard library. The net/http package is documented at https://golang.org/pkg/net/http/ and contains the HTTP and HTTPS utilities. At first, I advise that you stay away from the community HTTP frameworks and stick to the Go standard library. The standard HTTP package includes functions for listening, routing, and templating. The built-in HTTP server is of production quality, and it binds directly to a port, eliminating the need for a separate httpd, such as Apache, IIS, or nginx. However, it is common to see nginx listening on the public port 80 and reverse proxying all requests to Go servers listening on local ports other than 80.
In this chapter, we cover the basics of running an HTTP server, using HTTPS, setting secure cookies, and escaping output. We also cover how to use the Negroni middleware package and implement custom...