Example #1
0
func (a *BasicController) RegisterHandlers(r *mux.Router) {
	if a.allowOrigin {
		r.HandleFunc(a.basePath+"/{id}", a.Delete).Methods("DELETE", "OPTIONS")
		r.HandleFunc(a.basePath+"/{id}", a.Get).Methods("GET", "OPTIONS")
		r.HandleFunc(a.basePath, a.List).Methods("GET", "OPTIONS")
		r.HandleFunc(a.basePath, a.Set).Methods("POST", "OPTIONS")
	} else {
		r.HandleFunc(a.basePath+"/{id}", a.Delete).Methods("DELETE")
		r.HandleFunc(a.basePath+"/{id}", a.Get).Methods("GET")
		r.HandleFunc(a.basePath, a.List).Methods("GET")
		r.HandleFunc(a.basePath, a.Set).Methods("POST")
	}
}
func (b *BalancedInstancesController) RegisterHandlers(r *mux.Router) {
	// r.HandleFunc(b.basePath, b.List).Methods("GET")
	r.HandleFunc(b.basePath+"/{id}", b.Get).Methods("GET")
	// retro compatibility alias
	r.HandleFunc("/app/{id}", b.Get).Methods("GET")
}