Add the controversial gorillize()

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-10-08 19:39:44 +02:00
parent 037347dbe3
commit 2cd96d5a4b
2 changed files with 124 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package mux
import (
"net/http"
"github.com/BBVA/kapow/internal/server/model"
"github.com/gorilla/mux"
)
func gorillize(rs []model.Route, f func(*model.Handler) http.Handler) *mux.Router {
m := mux.NewRouter()
for _, r := range rs {
m.Handle(r.Pattern, f(nil)).Methods(r.Method)
}
return m
}