Simple Static File server, to get the current working directory and display it in a browser. Includes CLI part for customization.
package main
import (
"flag"
"net/http"
"os"
)
func main() {
var dir string
port := flag.String("port", "3000", "HTTP Port to serve")
path := flag.String("path", "", "path to serve")
flag.Parse()
if *path == "" {
dir, _ = os.Getwd()
} else {
dir = *path
}
http.ListenAndServe(":"+*port, http.FileServer(http.Dir(dir)))
}