Versions in this module Expand all Collapse all v0 v0.0.9 Jan 20, 2023 Changes in this version type Router + func (r *Router) UseFunc(middlewareFuncs ...func(HandlerFunc) HandlerFunc) *Router v0.0.8 Jan 20, 2023 Changes in this version type Error + func NewInternalError(args ...string) Error v0.0.7 Oct 11, 2022 Changes in this version + var ErrNotFoundEndpoint = NewError(404, "endpoint_not_found", "Endpoint not found") + type CorsMiddleware struct + AllowedHeaders []string + AllowedMethods []string + AllowedOrigin string + func (mw *CorsMiddleware) Middleware(next HandlerFunc) HandlerFunc + type Error interface + Error func() string + GetCode func() string + GetMessage func() string + GetStatus func() int + func FromAnotherError(err error) Error + func NewBadRequestError(args ...string) Error + func NewError(status int, code, msg string) Error + func NewNotFoundError(args ...string) Error + type HandlerFunc func(ResponseWriter, *Request) + type Middleware interface + Middleware func(next HandlerFunc) HandlerFunc + type Reply interface + GetError func() error + New func() Reply + SetError func(error) + SetResponse func(interface{}) + type Request struct + Headers http.Header + Route *Route + Vars Vars + func NewRequest(r *http.Request, rt *Route) *Request + type ResponseWriter struct + func NewResponseWriter(w http.ResponseWriter, commonReply Reply) ResponseWriter + func (w *ResponseWriter) WriteError(err error) bool + func (w *ResponseWriter) WriteJSON(src interface{}) error + func (w *ResponseWriter) WriteReply(rpl Reply) (int, error) + func (w *ResponseWriter) WriteResponse(resp interface{}) (int, error) + type Route struct + Endpoint string + Method string + func NewRoute(method, endpoint string, fn interface{}) *Route + type Router struct + func NewRouter() *Router + func (r *Router) Add(rts ...*Route) *Router + func (r *Router) Delete(endpoint string, fn interface{}) *Route + func (r *Router) Get(endpoint string, fn interface{}) *Route + func (r *Router) Handler() *mux.Router + func (r *Router) Patch(endpoint string, fn interface{}) *Route + func (r *Router) Post(endpoint string, fn interface{}) *Route + func (r *Router) Put(endpoint string, fn interface{}) *Route + func (r *Router) ServeHTTP(hw http.ResponseWriter, hr *http.Request) + func (r *Router) SetCustomReply(rpl Reply) + func (r *Router) SetMethodNotAllowedHandlerFunc(handler func(ResponseWriter, *Request)) + func (r *Router) SetNotFoundHandlerFunc(handler func(ResponseWriter, *Request)) + func (r *Router) Use(middlewares ...Middleware) *Router + type Vars map[string]interface + func (v Vars) String(key string, defaultValue ...string) string + func (v Vars) StringOk(key string) (string, bool) + func (vars Vars) Int(key string, defaultValue ...int) int + func (vars Vars) Int32(key string, defaultValue ...int32) int32 + func (vars Vars) Int32Ok(key string) (ret int32, ok bool) + func (vars Vars) Int64(key string, defaultValue ...int64) int64 + func (vars Vars) Int64Ok(key string) (ret int64, ok bool) + func (vars Vars) IntOk(key string) (ret int, ok bool) + func (vars Vars) Set(key string, value interface{}) + func (vars Vars) Uint(key string, defaultValue ...uint) uint + func (vars Vars) Uint32(key string, defaultValue ...uint32) uint32 + func (vars Vars) Uint32Ok(key string) (ret uint32, ok bool) + func (vars Vars) Uint64(key string, defaultValue ...uint64) uint64 + func (vars Vars) Uint64Ok(key string) (ret uint64, ok bool) + func (vars Vars) UintOk(key string) (ret uint, ok bool) + func NewVars(r *http.Request) Vars