commit 10110d8ae15959653cccaa65c79bf0d4e10d52b4 Author: Stephen McQuay Date: Mon Oct 21 13:45:14 2013 -0700 init diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..a583952 --- /dev/null +++ b/.hgignore @@ -0,0 +1 @@ +servedir diff --git a/main.go b/main.go new file mode 100644 index 0000000..e39e65f --- /dev/null +++ b/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "log" + "net/http" +) + +func logger(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + log.Printf("%s: %s\n", r.RemoteAddr, r.URL) + h.ServeHTTP(w, r) + }) +} + +func main() { + fh := http.FileServer(http.Dir("./")) + http.ListenAndServe(":8080", logger(fh)) +}