func (r Routes) Apply(router zerver.Router) error { for pat, rt := range r { if rt.Handler == nil { rt.Handler = rt.MapHandler } err := router.Handler(pat, rt.Handler) if err != nil { return err } } return nil }
func Enable(monitorPath string, rt zerver.Router) (err error) { if monitorPath != "" { path = monitorPath } if !initRoutes() { return } for subpath, handler := range routes { if err = rt.Handler(path+subpath, handler); err != nil { return } options = append(options, "GET "+path+subpath+": "+infos[subpath]+"\n") } err = rt.Filter(path, zerver.FilterFunc(globalFilter)) return }