core

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPI

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) Handler

func (a *API) Handler() http.Handler

Handler returns an http handler created from the main router

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) Router

func (a *API) Router() *mux.Router

Router returns the main router

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL