package faq import ( apicontrollers "git.golem15.com/golem15/sm-faq-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 FAQ API. const BucketPublicAPI = "faq-public-api" // Routes mounts the anonymous read API under /_faq/api/v1 (D-17). The group // never attaches the backend middleware: anonymous callers would get 401. // The slug is checked in the handler, so every miss is the JSON 404. CORS is // the host's: it adds _faq/api/* to cors.paths. func (p *Plugin) Routes(r pact.Router) error { r.Group("/_faq/api/v1", surf.Use("throttle:"+BucketPublicAPI), func(g pact.Router) { g.Get("/faqs/{slug}", apicontrollers.Show(p.app)) }) return nil }