wrapper

package
v0.0.0-...-6e5bb36 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 3 Imported by: 0

README

wrapper

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IWrapper

type IWrapper interface {
	chi.Router
	Action(...customrest.ICustomRest)
}

IWrapper ...

func New

func New(opts ...Option) IWrapper

New ...

type Option

type Option func(*Wrapper)

Option ...

func WithRouter

func WithRouter(router chi.Router) Option

WithRouter ...

type Wrapper

type Wrapper struct {
	chi.Router
	PrepareHandler customrest.Handler
}

Wrapper wraps chi.Router to pre-process http.Handler and add support for ActionHandler

func (*Wrapper) Action

func (r *Wrapper) Action(handlers ...customrest.ICustomRest)

Action adds one or more HTTPAction for `h.Pattern()` that matches the `h.HTTPMethod()` HTTP method

func (*Wrapper) Group

func (r *Wrapper) Group(fn func(r chi.Router)) chi.Router

Group adds a new inline-Router along the current routing path, with a fresh middleware stack for the inline-Router

func (*Wrapper) Handle

func (r *Wrapper) Handle(pattern string, handler http.Handler)

Handle adds routes for `pattern` that matches all HTTP methods

func (*Wrapper) Method

func (r *Wrapper) Method(method, pattern string, handler http.Handler)

Method adds routes for `pattern` that matches the `method` HTTP method

func (*Wrapper) Mount

func (r *Wrapper) Mount(pattern string, handler http.Handler)

Mount attaches another http.Handler along ./pattern/*

func (*Wrapper) Route

func (r *Wrapper) Route(pattern string, fn func(r chi.Router)) chi.Router

Route mounts a sub-Router along a `pattern“ string.

func (*Wrapper) With

func (r *Wrapper) With(middlewares ...func(http.Handler) http.Handler) chi.Router

With adds inline middlewares for an endpoint handler

Jump to

Keyboard shortcuts

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