18 lines
311 B
Go
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
|
|
} |