Initial Commit

This commit is contained in:
Brian Buller 2015-04-14 15:21:11 -05:00
parent 7994d145f2
commit c01a1e2cbd
1 changed files with 27 additions and 0 deletions

27
main.go Normal file
View File

@ -0,0 +1,27 @@
package main
import (
"log"
"net/http"
"os"
)
func main() {
args := os.Args[1:]
port := "8080"
if len(args) == 0 {
log.Println("Usage: quickhttp <content-dir> [port]")
os.Exit(1)
}
content_dir := args[0]
if len(args) == 2 {
port = args[1]
}
// Public Views
fs := http.FileServer(http.Dir(content_dir))
http.Handle("/", fs)
log.Println("Listening...")
log.Fatal(http.ListenAndServe(":"+port, nil))
}