httprouter_middleware

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Groups
	Groups Groups
	// Routes
	Routes Routes
}

type Group

type Group struct {
	// Routes in the group
	Routes []Route
	// Set of middlewares to be applied to the routes. If a route already has its pipeline, group's pipeline will wrap it
	Pipeline Pipeline
}

Group struct represents a group of routes. Pipeline middlewares will be applied to all routes in the group

type Groups

type Groups []Group

Groups

type Middleware

type Middleware func(next httprouter.Handle) httprouter.Handle

Middleware wraps the next handler

type Pipeline

type Pipeline []Middleware

Pipeline the pipeline of middlawares

type Route

type Route struct {
	// Path
	Path string
	// Handle function
	Handler httprouter.Handle
	// Method verb
	Method string
	// Set of middlewares to be applied to the routes
	Pipeline Pipeline
}

Route struct for representing a route

type Router

type Router struct {
	*httprouter.Router
}

Router wrapper for httprouter.Router

func New

func New(r *httprouter.Router, c *Config) *Router

func NewDefaultRouter

func NewDefaultRouter(c *Config) *Router

func (*Router) Apply

func (r *Router) Apply(c *Config)

type Routes

type Routes []Route

Routes

Jump to

Keyboard shortcuts

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