Add the controversial gorillize()
Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user