router

package
v0.0.0-...-87e0fb7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2019 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package router provides utils to add middleware handlers to http handler functions.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware func(http.HandlerFunc) http.HandlerFunc

type Router

type Router map[string]handler
Example
Output:

func (*Router) Add

func (r *Router) Add(mw ...Middleware)

Add middleware handlers to all routes. See AddRoute for more details.

func (*Router) AddRoute

func (r *Router) AddRoute(route string, mw ...Middleware)

AddRoute adds middleware handlers to the given route. Middleware will executed in the order provided.

func (*Router) Build

func (r *Router) Build()

Build registers all middleware and http handlers set until now. This method must be called when all middleware and http handlers have been added.

func (*Router) HandlerFunc

func (r *Router) HandlerFunc(route string, h http.HandlerFunc)

HandlerFunc sets the handler function to the given route. There can be only one handler function per route.

Jump to

Keyboard shortcuts

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