init
This commit is contained in:
commit
10110d8ae1
18
main.go
Normal file
18
main.go
Normal 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))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user