* serving of files and directories
* LetsEncrypt certificates and SSL
package main import ( "fmt" "net/http" "path/filepath" ) var ( host = "0.0.0.0" path = "/var/www/public" port = 8080 ) func main() { path, err := filepath.Abs(path) if err != nil { panic(err) } listenAt := fmt.Sprintf("%s:%v", host, port) fmt.Println("static-serve-dir serving", path, "over http at", listenAt) err = http.ListenAndServe(listenAt, http.FileServer(http.Dir(path))) if err != nil { panic(err) } }
[0]: https://godoc.org/golang.org/x/crypto/acme/autocert