From 10110d8ae15959653cccaa65c79bf0d4e10d52b4 Mon Sep 17 00:00:00 2001 From: Stephen McQuay Date: Mon, 21 Oct 2013 13:45:14 -0700 Subject: [PATCH] init --- .hgignore | 1 + main.go | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .hgignore create mode 100644 main.go 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)) +}