Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAPI ¶
func NewAPI(cfg config.APIConfigInterface) webiface.APIInterface
NewAPI returns a new API object implementing webiface.APIInterface by default the monitoring and status blueprints are registered and the APITimer and APICount middleware are applied
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the main object to create a web application has the config as attribute and it is basically a wrapper around a mux.Router with helpers method to add endpoints (grouped via BlueprintInterface) also monitor andlogger are attributes
func (*API) RegisterBlueprints ¶
func (a *API) RegisterBlueprints(r *mux.Router, blueprints ...webiface.BlueprintInterface)
UseMiddlewares will register all the blueprints to the passed in router if no router r is passed, then the main one is used
func (*API) UseMiddlewares ¶
func (a *API) UseMiddlewares(r *mux.Router, mwf ...mux.MiddlewareFunc)
UseMiddlewares will apply all the middleware functions to the passed in router if no router r is passed, then the main one is used