routermanager

package module
v0.0.0-...-5ee959b Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: BSD-2-Clause Imports: 6 Imported by: 0

README

routermanager

A Go router manager that add routes with custom input to popular Go routing libraries

Documentation

Index

Constants

View Source
const (
	ROUTER_GORILLA int = iota + 1 // Start at 1 to error on no input
	ROUTER_CHI
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

type Default struct {
	Ctx   context.Context
	W     http.ResponseWriter
	R     *http.Request
	Rtime int64
	Htime int64
}

Default includes fields required to process requests

type Handler

type Handler func(*Default, interface{})

type Middleware

type Middleware func(func(*Default, interface{})) Handler

type Route

type Route struct {
	// The request path
	Path string

	// The request method
	Method string

	// Middleware can be used to modify requests and/or responses
	Middleware []Middleware

	// Input is custom input needed to handle the request
	// Input is typically a struct pointer
	Input interface{}

	// The request handler
	Handler Handler
}

type Routes

type Routes struct {
	Router int
	Routes []*Route
}

func (*Routes) Process

func (r *Routes) Process() (http.Handler, error)

Process adds the routes to the router specified in the Router field

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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