chi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler deprecated added in v0.16.5

func Handler(prefix string, options ...rest.Option) http.Handler

Handler returns handler based on github.com/go-chi/chi.

Deprecated: use go.octolab.org/toolkit/protocol/http/router/rest instead.

func PackHandler deprecated

func PackHandler(method string, handler http.Handler, placeholders ...string) rest.Handler

PackHandler packs rest.Handler into rest.Handler using chi router.

mux := http.NewServeMux()
mux.Handle(
	chi.Routing("/v1/",
		rest.WithPackedHandlers(
			chi.PackHandler(gohttp.MethodGet, api.HandlerX),
			chi.PackHandler(gohttp.MethodGet, api.HandlerY),
			chi.PackHandler(gohttp.MethodGet, api.HandlerZ),
		),
	),
)

Deprecated: use go.octolab.org/toolkit/protocol/http/middleware/chi.Converter instead.

func PackHandlerFunc deprecated

func PackHandlerFunc(method string, handler http.HandlerFunc, placeholders ...string) rest.HandlerFunc

PackHandlerFunc packs rest.HandlerFunc into rest.HandlerFunc using chi router.

mux := http.NewServeMux()
mux.HandleFunc(
	api.V2("/v2/",
		chi.PackHandlerFunc(gohttp.MethodGet, api.HandlerFuncX),
		chi.PackHandlerFunc(gohttp.MethodGet, api.HandlerFuncY),
		chi.PackHandlerFunc(gohttp.MethodGet, api.HandlerFuncZ),
	),
)

Deprecated: use go.octolab.org/toolkit/protocol/http/middleware/chi.Converter instead.

func Routing deprecated

func Routing(prefix string, options ...rest.Option) (string, gohttp.Handler)

Routing is a glue for a http listener and the github.com/go-chi/chi router.

mux := http.NewServeMux()
mux.Handle(chi.Routing("/api/", rest.WithMiddlewares(...), rest.WithHandlers(...)))
http.ListenAndServe("localhost:8080", mux)

Deprecated: use go.octolab.org/toolkit/protocol/http/router/rest instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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