/* Project: Handler Purpose: Provide simple HTTP file server; Its so simple to do with golang; looks like nobody bothers to provide a ready-to-download package to actually do it. Author: Caleb Vorderbruggen */ package main import ( "flag" "log" "net/http" ) func main() { p := flag.String("p", "8080", "HTTP Server Port") dir := flag.String("d", "./", "Directory to serve") address := flag.String("a", "0.0.0.0", "IP Address to use") flag.Parse() http.Handle("/", http.FileServer(http.Dir(*dir))) log.Printf("Serving HTTP on %s port %s at %s (http://%s:%s/)\n", *address, *p, *dir, *address, *p) log.Fatal(http.ListenAndServe(*address+":"+*p, nil)) }