Skip to content

Commit

Permalink
Merge pull request #2 from yohgo/release-1.0.2
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
zorbasd authored Sep 5, 2017
2 parents 17496d6 + 55f9198 commit 74d31e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion router.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package mux

import (
"strings"

"github.com/gorilla/mux"
)

// NewRouter constructs a new mux router with a slice of user defined routes
func NewRouter(routes Routes) *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
methods := strings.Split(route.Method, ",")
router.
Methods(route.Method).
Methods(methods...).
Path(route.Path).
Name(route.Name).
Handler(route.HandlerFunc)
Expand Down

0 comments on commit 74d31e7

Please sign in to comment.