router

package
Version: v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(req *request.HTTP) response.HTTP

Handler represents a route handler.

type Middleware

type Middleware func(next Handler) Handler

Middleware represents a route middleware.

type Options

type Options struct {
	Prefix     string
	Middleware Middleware
}

Options represents the route options.

type Route

type Route struct {
	URI     string
	Method  request.Type
	Handler Handler
}

Route is the definition of a route.

type Router

type Router struct {
	Routes []Route

	Childs []*Router
	// contains filtered or unexported fields
}

Router determines how a route is.

var Routes Router

Routes representrs the global application routes.

func (*Router) Delete

func (r *Router) Delete(uri string, handler Handler) *Router

Delete creates a DELETE route.

func (*Router) Get

func (r *Router) Get(uri string, handler Handler) *Router

Get creates a GET route.

func (*Router) Group

func (r *Router) Group(options *Options, routes func(r *Router)) *Router

Group certain routes uner certain options.

func (*Router) Head

func (r *Router) Head(uri string, handler Handler) *Router

Head creates a HEAD route.

func (*Router) Patch

func (r *Router) Patch(uri string, handler Handler) *Router

Patch creates a PATCH route.

func (*Router) Post

func (r *Router) Post(uri string, handler Handler) *Router

Post creates a POST route.

func (*Router) Put

func (r *Router) Put(uri string, handler Handler) *Router

Put creates a PUT route.

Source Files

Jump to

Keyboard shortcuts

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