urlrouter

package module
v0.0.0-...-aa9c839 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 4 Imported by: 3

README

urlrouter

Documentation

Overview

URL router provides a simple clean way of setting up multiplexed url routes.

Index

Constants

View Source
const (
	NAMED_PAAMTERS urlNamedParameter = "urlrouter_named_parameters"
)

Variables

This section is empty.

Functions

func GetNamedParamters

func GetNamedParamters(ctx context.Context) map[string]string

Types

type Router

type Router struct {
	// contains filtered or unexported fields
}

func New

func New() *Router

func (*Router) HandleFunc

func (router *Router) HandleFunc(method string, path string, handlerFunc http.HandlerFunc)

Add a new url handler to the router. If a route already exists with the same url path, then this will overwrite the previous handler.

	PARAMS:
	- method - API method to match against. Commonly one of: POST, PUT, PATCH, GET, DELETE
	- path - The path of a URL. This will panic if path is the empty string
 - handlerFunc - handler callback to used when a pathi is found. This will panic if the handlerFunc is nil

func (*Router) ServeHTTP

func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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