Initial commit trying to turn bot to have RESTful JSON endpoint

This commit is contained in:
Scott
2016-05-23 22:18:42 +10:00
parent 3b0e4c98a8
commit 4b2a336e1b
8 changed files with 172 additions and 135 deletions

25
restfulRouter.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"net/http"
"github.com/gorilla/mux"
)
func NewRouter(exchanges []IBotExchange) *mux.Router {
router := mux.NewRouter().StrictSlash(true)
allRoutes := append(routes,anxRoutes...)
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
}