s3manager-web/router.go
2016-12-20 19:47:36 +01:00

27 lines
429 B
Go

package main
import (
"net/http"
"github.com/gorilla/mux"
)
// NewRouter creates a new router
func NewRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
var handler http.Handler
handler = route.HandlerFunc
handler = Logger(handler, route.Name)
router.
Methods(route.Method).
Path(route.Pattern).
Name(route.Name).
Handler(handler)
}
return router
}