Files
gocryptotrader/restfulRouter.go
Scott 95cfb356ba Adds GetTickerPrice(currency string) TickerPrice func to interface. Implements on all exchanges (where possible)
Attempts to make routing generic with /exchanges/{exchangeName}/latest/{currency} path and response
2016-06-05 19:10:32 +10:00

25 lines
547 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...)
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
}