This commit is contained in:
Stephen McQuay 2013-10-21 13:45:14 -07:00
commit 10110d8ae1
2 changed files with 19 additions and 0 deletions

1
.hgignore Normal file
View File

@ -0,0 +1 @@
servedir

18
main.go Normal file
View File

@ -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))
}