routes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	Mux *mux.Router

	//             url       method					handler
	Endpoints map[string]map[string]func(http.ResponseWriter, *http.Request)
}

Router structure is a url handler

func NewRouter

func NewRouter(r *mux.Router) Router

NewRouter basically creates router

func (*Router) AddRoute

func (r *Router) AddRoute(route string, handlers map[string]func(http.ResponseWriter, *http.Request))

AddRoute will append your route to Endpoints

func (*Router) Prepare

func (r *Router) Prepare() *mux.Router

Prepare parses Endpoints property and returns mux with applied routes

Jump to

Keyboard shortcuts

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