Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is what registers the UI and API routes for managing builds. It implements the server.Router interface.
func (*Router) RegisterAPI ¶
RegisterAPI registers the API routes for working with builds. The given prefix string is used to specify where the API is being served under. This applies all of the given gates to all routes registered. These routes response with a "application/json" Content-Type.
func (*Router) RegisterUI ¶
func (r *Router) RegisterUI(mux *mux.Router, csrf func(http.Handler) http.Handler, gates ...web.Gate)
RegisterUI registers the UI routes for working with builds. There are three types of route groups, webhooks, simple auth routes, and individual build routes. These routes, aside for webhook routes, respond with a "text/html" Content-Type.
webhooks - The webhook routes are registered under the "/hook" prefix of the given router. No CSRF protection is applied to these routes, verficiation of the requests are done within the handlers themselves.
simple auth routes - These routes are registered under the "/" prefix of the given router. The Auth middleware is applied to all registered routes. CSRF protection is applied to all the registered routes.
individual build routes - These routes are registered under the "/b/{username}/{build:[0-9]}" prefix of the given router. Each given gate is applied to the registered routes, along with the given CSRF protection.