Files
gocryptotrader/restfulRouter.go
GloriousCode df295a122c Removes "/web" folder requirement when running app.
[WIP]Adds config route to modify settings within app.
2016-07-27 19:09:08 +10:00

27 lines
516 B
Go

package main
import (
"net/http"
"github.com/gorilla/mux"
)
func NewRouter(exchanges []IBotExchange) *mux.Router {
router := mux.NewRouter().StrictSlash(true)
allRoutes := append(routes, exchangeRoutes...)
allRoutes = append(allRoutes, configRoutes...)
for _, route := range allRoutes {
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
}