heruvym/router/router.go

18 lines
311 B
Go
Raw Normal View History

2021-05-15 14:03:10 +00:00
package router
import (
"github.com/gorilla/mux"
"net/http"
)
func NewRouter(additional... map[string]http.HandlerFunc) *mux.Router {
apiMux := mux.NewRouter()
for _, handler := range additional {
for endpoint, handler := range handler {
apiMux.HandleFunc(endpoint, handler)
}
}
return apiMux
}