mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
31 lines
758 B
Go
31 lines
758 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
"github.com/thrasher-/gocryptotrader/exchanges"
|
|
)
|
|
|
|
// NewRouter takes in the exchange interfaces and returns a new multiplexor
|
|
// router
|
|
func NewRouter(exchanges []exchange.IBotExchange) *mux.Router {
|
|
router := mux.NewRouter().StrictSlash(true)
|
|
allRoutes := append(routes, ExchangeRoutes...)
|
|
allRoutes = append(allRoutes, ConfigRoutes...)
|
|
allRoutes = append(allRoutes, PortfolioRoutes...)
|
|
allRoutes = append(allRoutes, WalletRoutes...)
|
|
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
|
|
}
|