In this example, an HTTP server demonstrates how simple it is to create a listening server with the standard library. There is no routing or multiplexing yet. In this case, a specific directory is served through the server. http.FileServer() has directory listing built in, so if you make an HTTP request to /, then it will list the files available in the directory being served:
package mainimport ( "fmt" "log" "net/http" "os")func printUsage() { fmt.Println(os.Args[0] + ` - Serve a directory via HTTPURL should include protocol IP or hostname and port separated by colon.Usage: ` + os.Args[0] + ` <listenUrl> <directory>Example: ` + os.Args[0] + ` localhost:8080 . ` + os.Args[0] + ` 0.0.0.0:9999 /home/nanodano`)}func checkArgs() ...