Added to readme

This commit is contained in:
idk
2018-07-26 23:15:27 -04:00
parent 83ff8e863e
commit a409a5f977
5 changed files with 196 additions and 8 deletions

18
example/serve.go Normal file
View File

@@ -0,0 +1,18 @@
package main
import (
"flag"
"log"
"net/http"
)
func main() {
port := flag.String("p", "8101", "port to serve on")
directory := flag.String("d", ".", "the directory of static file to host")
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*directory)))
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
log.Fatal(http.ListenAndServe(":"+*port, nil))
}