Files
ipe/ipe/router.go
T
claudemiro 8dbd3ccbea Removing the expvar handler.
I am removing the expvar handler, this is uncessary to me. I was using
the goji/httpauth package to authenticate this handler, so, I am
removing the dependency too.
2015-06-13 09:18:40 -03:00

34 lines
788 B
Go

// Copyright 2014 Claudemiro Alves Feitosa Neto. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package ipe
import (
_ "expvar"
"net/http"
"github.com/dimiro1/ipe/vendor/github.com/gorilla/mux"
)
// newRouter is a function that returns a new configured Router
// It add the necessary middlewares
func newRouter() *mux.Router {
router := mux.NewRouter().StrictSlash(true)
for _, route := range routes {
var handler http.Handler
handler = route.HandlerFunc
if route.RequiresRestAuth {
handler = restAuthenticationHandler(handler)
handler = restCheckAppDisabledHandler(handler)
}
router.Methods(route.Method).Path(route.Pattern).Name(route.Name).Handler(handler)
}
return router
}