added store
This commit is contained in:
parent
ea6546ec17
commit
0570e47be9
6 changed files with 208 additions and 151 deletions
17
middleware.go
Normal file
17
middleware.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func logger(in http.HandlerFunc) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
log := fmt.Sprint(r.Method, " ", r.URL.String())
|
||||
in(w, r)
|
||||
log += fmt.Sprint(" ", time.Since(start))
|
||||
fmt.Println(log)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue