docker backoff, routes middleware
This commit is contained in:
parent
0881151a44
commit
07b520fe23
4 changed files with 63 additions and 21 deletions
28
middlewares/routes.go
Normal file
28
middlewares/routes.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
Copyright
|
||||
*/
|
||||
package middlewares
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
"github.com/gorilla/mux"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type Routes struct {
|
||||
router *mux.Router
|
||||
}
|
||||
|
||||
func NewRoutes(router *mux.Router) *Routes {
|
||||
return &Routes{router}
|
||||
}
|
||||
|
||||
func (router *Routes) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
||||
routeMatch :=mux.RouteMatch{}
|
||||
if(router.router.Match(r, &routeMatch)){
|
||||
json, _ := json.Marshal(routeMatch.Handler)
|
||||
log.Println("Request match route ", json)
|
||||
}
|
||||
next(rw, r)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue