package menu import ( apicontrollers "git.golem15.com/golem15/sm-menu-plugin/controllers/api" "git.golem15.com/golem15/summercms/modules/pact" "git.golem15.com/golem15/summercms/modules/surf" ) // BucketPublicAPI is the throttle bucket of the public menu API. const BucketPublicAPI = "menu-public-api" // Routes mounts the anonymous read API under /_menu/api/v1 (D-16). The group // never attaches the backend middleware: anonymous callers would get 401. // The menu code is checked in the handler, so every miss is the JSON 404. // CORS is the host's: it adds _menu/api/* to cors.paths. func (p *Plugin) Routes(r pact.Router) error { r.Group("/_menu/api/v1", surf.Use("throttle:"+BucketPublicAPI), func(g pact.Router) { g.Get("/menus/{code}", apicontrollers.Show(p.app)) }) return nil }