Documentation ¶
Index ¶
- func AddContext(key string, value interface{})
- func AddContexts(m ContextMap)
- func AddMiddleware(mw Middleware)
- func Handle(pattern string, handler Handler)
- func ParsedModel(r *http.Request) interface{}
- func RealIP(r *http.Request) string
- func Render(w http.ResponseWriter, r *http.Request, model interface{})
- func RenderError(w http.ResponseWriter, r *http.Request, err error)
- func RenderErrorWithStatusCode(w http.ResponseWriter, r *http.Request, statusCode int, err error)
- func RenderMessage(w http.ResponseWriter, r *http.Request, msg string)
- func RenderMessageWithStatusCode(w http.ResponseWriter, r *http.Request, statusCode int, msg string)
- func RenderWithStatusCode(w http.ResponseWriter, r *http.Request, statusCode int, model interface{})
- func SelectMethod(chain Middleware, handler Handler) http.HandlerFunc
- func ServeSinglePageApp(path string, mainHTMLFile string)
- func SetConfig(_config Config)
- type Config
- type ContextMap
- type Handler
- type Middleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContext ¶
func AddContext(key string, value interface{})
func AddContexts ¶
func AddContexts(m ContextMap)
func AddMiddleware ¶
func AddMiddleware(mw Middleware)
func ParsedModel ¶
func RenderError ¶
func RenderError(w http.ResponseWriter, r *http.Request, err error)
func RenderMessage ¶
func RenderMessage(w http.ResponseWriter, r *http.Request, msg string)
func RenderWithStatusCode ¶
func RenderWithStatusCode(w http.ResponseWriter, r *http.Request, statusCode int, model interface{})
func SelectMethod ¶
func SelectMethod(chain Middleware, handler Handler) http.HandlerFunc
func ServeSinglePageApp ¶
ServeSinglePageApp <-
Types ¶
type ContextMap ¶
type ContextMap map[string]interface{}
func RequestContext ¶
func RequestContext() ContextMap
type Handler ¶
type Handler struct { Pattern string PostHandler http.HandlerFunc PostModel interface{} GetHandler http.HandlerFunc GetModel interface{} DeleteHandler http.HandlerFunc DeleteModel interface{} RequiredGet params.R OptionalGet params.R AddMiddlewares []Middleware AddMiddleware *Middleware PreProcess func(ctx context.Context) error }
Handler configured
func (Handler) HandlerFunc ¶
func (h Handler) HandlerFunc() http.HandlerFunc
func (Handler) WsReady ¶ added in v1.0.32
func (h Handler) WsReady() Middleware
type Middleware ¶
type Middleware func(next http.HandlerFunc) http.HandlerFunc
func AdditionalMiddlewares ¶
func AdditionalMiddlewares() []Middleware
func Chain ¶
func Chain(mw ...Middleware) Middleware
Chain chain multiple middlewares copied from: https://hackernoon.com/simple-http-middleware-with-go-79a4ad62889b
Source Files ¶
Click to show internal directories.
Click to hide internal directories.