router

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params = map[string]string

type Request

type Request struct {
	Raw         *gemini.Request
	PathParams  Params
	QueryParams Params
	RawQuery    string
}

type Route

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

func NewMustRoute

func NewMustRoute(pattern string, fn RouteFunction) Route

func NewRoute

func NewRoute(pattern string, fn RouteFunction) (Route, error)

func (Route) Match

func (r Route) Match(path string) (map[string]string, bool)

type RouteFunction

type RouteFunction func(ctx context.Context, w gemini.ResponseWriter, rq Request)

type RoutePart

type RoutePart struct {
	Key     string
	Matcher bool
	Splat   bool
}

type Router

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

func NewRouter

func NewRouter(routes ...Route) Router

func (Router) ServeGemini

func (r Router) ServeGemini(ctx context.Context, w gemini.ResponseWriter, rq *gemini.Request)

type RouterMatch

type RouterMatch struct {
	Router Router
	Params Params
}

Jump to

Keyboard shortcuts

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