heruvym/router/router.go
2021-05-15 17:03:46 +03:00

18 lines
311 B
Go

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
}